Ejemplo n.º 1
0
        public async Task <JsonResult> GetNewTaskItem(TaskItemModel model)
        {
            try
            {
                TaskItemDto dto = _mapper.Map <TaskItemDto>(model);
                dto = await _taskItemService.GetNewTask(dto);

                dto.TaskItemAssigns.Add(new TaskItemAssignDto
                {
                    AssignToFullName     = CurrentUser.FullName,
                    AssignToJobTitleName = CurrentUser.Departments != null ? CurrentUser.Departments[0].JobTitle : string.Empty,
                    Department           = CurrentUser.Departments != null ? CurrentUser.Departments[0].Name : string.Empty,
                    AssignTo             = CurrentUser.Id,
                    TaskType             = Entities.TaskType.Primary
                });
                dto.AssignBy            = CurrentUser.Id; dto.AssignByFullName = CurrentUser.FullName;
                model                   = _mapper.Map <TaskItemModel>(dto);
                model.TaskItemAssignIds = model.TaskItemAssigns.Select(e => e.AssignTo).ToList();
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }