示例#1
0
        public JsonResult Put(Devices devices)
        {
            if (!ModelState.IsValid)
            {
                return(JsonResponse(ResponseType.error, ValidationErrors()));
            }

            try
            {
                devicesRepository.Update(devices);
                devicesRepository.SaveChanges();
                return(JsonResponse(ResponseType.success, ResponseMessage.ChangesSaved));
            }
            catch (DuplicateItemException die)
            {
                return(JsonResponse(ResponseType.error, die.Message));
            }
            catch (Exception ex)
            {
                return(InternalException(ex));
            }
        }