Newer
Older
TheCleanArchitecture / src / Application / Common / Models / Result.cs
@Derek Comartin Derek Comartin on 15 Jun 2021 651 bytes Reorganized
using System.Collections.Generic;
using System.Linq;

namespace CleanArchitecture.Application.Common.Models
{
    public class Result
    {
        internal Result(bool succeeded, IEnumerable<string> errors)
        {
            Succeeded = succeeded;
            Errors = errors.ToArray();
        }

        public bool Succeeded { get; set; }

        public string[] Errors { get; set; }

        public static Result Success()
        {
            return new Result(true, new string[] { });
        }

        public static Result Failure(IEnumerable<string> errors)
        {
            return new Result(false, errors);
        }
    }
}