Beispiel #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));
            }
        }
Beispiel #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));
            }
        }
Beispiel #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));
            }
        }
Beispiel #4
0
 public RancherException(RancherError error, string message) : base(message)
 {
     Error = error;
 }
Beispiel #5
0
 public RancherException(RancherError error)
 {
     Error = error;
 }