示例#1
0
        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));
        }
示例#2
0
        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, Request.Headers?.Authorization?.Parameter);
            AnatomyTag     s = (AnatomyTag)AnatomyTagsManager.GetBy(uuid);

            if (s == null)
            {
                return(ServiceResponse.Error("AnatomyTags could not be located for the uuid " + uuid));
            }

            return(ServiceResponse.OK("", s));
        }