Пример #1
0
 public JsonResult Post([FromBody] Devices devices)
 {
     if (!ModelState.IsValid)
     {
         return(JsonResponse(ResponseType.error, ResponseMessage.ValidationErrors));
     }
     try
     {
         devices.User = CurrentUser(hunter);
         devicesRepository.Add(devices);
         devicesRepository.SaveChanges();
         return(JsonResponse(ResponseType.success, ResponseMessage.ChangesSaved));
     }
     catch (Exception ex)
     {
         return(InternalException(ex));
     }
 }