예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 /// <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));
 }
예제 #4
0
 /// <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));
 }
예제 #5
0
 public int EditTask(int id, HelpDesk_Tasks_vm task)
 {
     return(_helpDeskTasksRepository.EditTask(id, mapViewModelToEntityTask(task)));
 }
예제 #6
0
 public int CreateTask(HelpDesk_Tasks_vm task)
 {
     return(_helpDeskTasksRepository.CreateTask(mapViewModelToEntityTask(task)));
 }