public ServiceResult Update(DoseLog form) { if (form == null) { return(ServiceResponse.Error("Invalid Strain sent to server.")); } DoseManager DoseManager = new DoseManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); var dbS = (DoseLog)DoseManager.GetBy(form.UUID); if (dbS == null) { return(ServiceResponse.Error("Strain was not found.")); } if (dbS.DateCreated == DateTime.MinValue) { dbS.DateCreated = DateTime.UtcNow; } dbS.Name = form.Name; dbS.Deleted = form.Deleted; dbS.Status = form.Status; dbS.SortOrder = form.SortOrder; return(DoseManager.Update(dbS)); }
public ServiceResult GetBy(string uuid) { if (Request.Headers.Authorization == null || string.IsNullOrWhiteSpace(Request.Headers?.Authorization?.Parameter)) { return(ServiceResponse.Error("You must be logged in to access this functionality.")); } if (CurrentUser == null) { return(ServiceResponse.Error("You must be logged in to access this function.")); } int count = 0; DoseManager DoseManager = new DoseManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); DoseLog d = (DoseLog)DoseManager.GetBy(uuid); return(ServiceResponse.OK("", d, count)); }