Пример #1
0
        public List <Rancher> GetRancher(int?id = null)
        {
            //Add validations here!
            RancherError result = RancherError.None;

            if (id != null && id <= 0)
            {
                result |= RancherError.InvalidId;
            }

            if (result != RancherError.None)
            {
                throw new RancherException(result);
            }
            else
            {
                return(rancherDL.GetRancher(id));
            }
        }
Пример #2
0
        public bool DeleteRancher(int id)
        {
            //Add validations here!
            RancherError result = RancherError.None;

            if (id <= 0)
            {
                result |= RancherError.InvalidId;
            }

            if (result != RancherError.None)
            {
                throw new RancherException(result);
            }
            else
            {
                return(rancherDL.DeleteRancher(id));
            }
        }
Пример #3
0
        public Rancher UpdateRancher(Rancher rancher)
        {
            //Add validations here!
            RancherError result = RancherError.None;

            if (string.IsNullOrEmpty(rancher.Name))
            {
                result |= RancherError.InvalidName;
            }
            if (rancher.StateId <= 0)
            {
                result |= RancherError.InvalidState;
            }
            if (result != RancherError.None)
            {
                throw new RancherException(result);
            }
            else
            {
                return(rancherDL.UpdateRancher(rancher));
            }
        }
Пример #4
0
 public RancherException(RancherError error, string message) : base(message)
 {
     Error = error;
 }
Пример #5
0
 public RancherException(RancherError error)
 {
     Error = error;
 }