public ServiceResult Update(Anatomy s) { if (s == null) { return(ServiceResponse.Error("Invalid Anatomy sent to server.")); } AnatomyManager anatomyManager = new AnatomyManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); var res = anatomyManager.Get(s.UUID); if (res.Code != 200) { return(res); } var dbS = (Anatomy)res.Result; if (dbS.DateCreated == DateTime.MinValue) { dbS.DateCreated = DateTime.UtcNow; } dbS.Deleted = s.Deleted; dbS.Name = s.Name; dbS.Status = s.Status; dbS.SortOrder = s.SortOrder; return(anatomyManager.Update(dbS)); }
public ServiceResult GetBy(string uuid) { if (string.IsNullOrWhiteSpace(uuid)) { return(ServiceResponse.Error("You must provide a name for the AnatomyTags.")); } AnatomyManager AnatomyTagsManager = new AnatomyManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); return(AnatomyTagsManager.Get(uuid)); }
public ServiceResult GetAnatomyByName(string name) { if (string.IsNullOrWhiteSpace(name)) { return(ServiceResponse.Error("You must provide a name for the Anatomy.")); } AnatomyManager anatomyManager = new AnatomyManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); Anatomy s = (Anatomy)anatomyManager.Get(name); if (s == null) { return(ServiceResponse.Error("Anatomy could not be located for the name " + name)); } return(ServiceResponse.OK("", s)); }