Beispiel #1
0
 // POST api/<controller>
 public int Post([FromBody] BacklogItemTaskDTO taskDto)
 {
     using (DataAccessLayer modelAccess = new DataAccessLayer())
     {
         try
         {
             LogHelper.InfoLog("Attempting to add Task for Backlog Item ID: " + taskDto.ProductBacklogID);
             return(modelAccess.AddTask(new BacklogItemTask
             {
                 ID = 0,
                 CurrentUserID = taskDto.CurrentUserID == 0 ? null : taskDto.CurrentUserID,
                 Description = taskDto.Description,
                 Name = taskDto.Name,
                 ProductBacklogID = taskDto.ProductBacklogID,
                 RemainingTime = taskDto.RemainingTime,
                 State = taskDto.State,
                 Archived = false
             }));
         }
         catch (Exception ex)
         {
             LogHelper.ErrorLog("Error Adding Task: " + ex.ToString());
             return(0);
         }
     }
 }
Beispiel #2
0
 // PUT api/<controller>/5
 public int Put(int id, [FromBody] BacklogItemTaskDTO taskDto)
 {
     using (DataAccessLayer modelAccess = new DataAccessLayer())
     {
         try
         {
             LogHelper.InfoLog("Attempting to update information for task ID: " + taskDto.BacklogItemTaskID);
             modelAccess.UpdateTask(id, new BacklogItemTask
             {
                 ID               = taskDto.BacklogItemTaskID,
                 CurrentUserID    = taskDto.CurrentUserID == 0 ? null : taskDto.CurrentUserID,
                 Description      = taskDto.Description,
                 Name             = taskDto.Name,
                 ProductBacklogID = taskDto.ProductBacklogID,
                 RemainingTime    = taskDto.RemainingTime,
                 State            = taskDto.State,
                 Archived         = taskDto.Archived
             });
             return(1);
         }
         catch (Exception ex)
         {
             LogHelper.ErrorLog("Error updating information for task: " + ex.ToString());
             return(0);
         }
     }
 }