public AssigneeUpdateDTO UpdateAssignee(int id, AssigneeUpdateDTO assignee)
 {
     using (UoW)
     {
         var error = UoW.Errors.Get(id);
         if (error == null)
         {
             throw new ApplicationOperationException(string.Format("Error with id {0} not found", id), HttpStatusCode.NotFound);
         }
         if (assignee.EmailAssignee != null)
         {
             var newAssignee = UoW.Users.GetByEmail(assignee.EmailAssignee);
             if (newAssignee == null)
             {
                 throw new ApplicationOperationException(string.Format("Error assignee with email {0} not found", assignee.EmailAssignee), HttpStatusCode.NotFound);
             }
             error.Assignee = newAssignee;
         }
         if (assignee.EmailAssignee == null)
         {
             error.AssigneeId = null;
             error.Assignee   = null;
         }
         UoW.Complete();
         return(assignee);
     }
 }
Ejemplo n.º 2
0
 public AssigneeUpdateDTO Assignee([Required] int id, [Required] AssigneeUpdateDTO assignee)
 {
     return(_errorService.UpdateAssignee(id, assignee));
 }