public ServiceResult Update(Anatomy s) { if (s == null) { return(ServiceResponse.Error("Invalid Anatomy sent to server.")); } AnatomyManager anatomyManager = new AnatomyManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); var dbS = (Anatomy)anatomyManager.GetBy(s.UUID); if (dbS == null) { return(ServiceResponse.Error("Anatomy was not found.")); } 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 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)); }