Ejemplo n.º 1
0
        public ServiceResult Update(DoseLog form)
        {
            if (form == null)
            {
                return(ServiceResponse.Error("Invalid Strain sent to server."));
            }

            DoseManager DoseManager = new DoseManager(Globals.DBConnectionKey, this.GetAuthToken(Request));
            var         res         = DoseManager.Get(form.UUID);

            if (res.Code != 200)
            {
                return(res);
            }

            var dbS = (DoseLog)res.Result;

            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));
        }
Ejemplo n.º 2
0
        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));
        }