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