2021-03-25 20:50:19 +04:00
|
|
|
|
using CommonTools.Enums;
|
|
|
|
|
using CommonTools.ViewModels;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace CommonTools.OperationResultModels
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Результат любой операции
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class OperationResultModel
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Успешность операции (количество ошибок = 0)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsSucceeded => Errors.Count == 0;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Статус операции
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ResultServiceStatusCode StatusCode { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Спсиок ошибок
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<(string Title, string Message)> Errors { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-03-26 20:09:52 +04:00
|
|
|
|
/// Объект, получаемый по результатам операции
|
2021-03-25 20:50:19 +04:00
|
|
|
|
/// </summary>
|
|
|
|
|
public object Result { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Конструктор по умолчанию
|
|
|
|
|
/// </summary>
|
|
|
|
|
public OperationResultModel()
|
|
|
|
|
{
|
|
|
|
|
Errors = new List<(string Title, string Message)>();
|
|
|
|
|
StatusCode = ResultServiceStatusCode.Success;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|