private HelpDesk_Tasks mapViewModelToEntityTask(HelpDesk_Tasks_vm VMTask) { ServiceDesk_Users assignedTo = _nsUserRepository.GetUserByUserName(VMTask.AssignedToUserName); var tasks = new HelpDesk_Tasks { Id = VMTask.Id, TicketID = VMTask.TicketID, Title = VMTask.Title, Description = VMTask.Description, StatusID = VMTask.StatusID, CreatedDateTime = VMTask.CreatedDateTime, StatusChangedDateTime = VMTask.StatusChangedDateTime, AssignedTo = assignedTo.Id }; return(tasks); }
private HelpDesk_Tasks_vm mapEntityToViewModelSingleTask(HelpDesk_Tasks EFTask) { _logger.Debug("Mapping Entity to Task View Model."); var vmT = new HelpDesk_Tasks_vm { Id = EFTask.Id, Title = EFTask.Title, TicketID = EFTask.TicketID, Description = EFTask.Description, StatusID = EFTask.StatusID, CreatedDateTime = EFTask.CreatedDateTime, StatusChangedDateTime = EFTask.StatusChangedDateTime, AssignedToUserName = EFTask.ServiceDesk_Users == null ? null : EFTask.ServiceDesk_Users.UserName, ServiceDesk_Users_AssignedTo = EFTask.ServiceDesk_Users == null ? null : new Task_User() { SID = EFTask.ServiceDesk_Users.SID, UserName = EFTask.ServiceDesk_Users.UserName, DisplayName = EFTask.ServiceDesk_Users.FirstName + " " + EFTask.ServiceDesk_Users.LastName } }; return(vmT); }
/// <summary> /// Puts the specified identifier. /// </summary> /// <param name="id">The identifier.</param> /// <param name="value">The value.</param> /// <returns></returns> public int Put(int id, [FromBody] HelpDesk_Tasks_vm value) { _logger.Info("Editing the task with id " + id); return(_helpDeskTaskManager.EditTask(id, value)); }
/// <summary> /// Posts the specified value. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> public int Post([FromBody] HelpDesk_Tasks_vm value) { _logger.Info("Adding a new task."); return(_helpDeskTaskManager.CreateTask(value)); }
public int EditTask(int id, HelpDesk_Tasks_vm task) { return(_helpDeskTasksRepository.EditTask(id, mapViewModelToEntityTask(task))); }
public int CreateTask(HelpDesk_Tasks_vm task) { return(_helpDeskTasksRepository.CreateTask(mapViewModelToEntityTask(task))); }