public IActionResult Create(Entities.Concrete.Task task) { CreateEditTaskViewModel model = null; try { model = new CreateEditTaskViewModel { Task = task, TaskTypes = _taskTypeManager.GetAll(), UserId = User.Identity.UserId(), }; _taskManager.Add(task); return(RedirectToAction(nameof(Index))); } catch (ValidationException ex) { ModelState.AddModelError("Error", ex.Message); return(View(model)); } catch (Exception ex) { _logger.LogError(ex.Message); return(Error()); } }
public int Add(TaskModel model) { var record = new Entities.Concrete.Task(); record.Detail = model.Detail; record.StartingDate = model.StartingDate; record.ExpirationDate = model.ExpirationDate; record.CreationDate = DateTime.Now; record = _taskDal.Add(record); return(record.Id); }
public IActionResult AssignToPerson(int id, string s, int page = 1) { TempData["menu"] = "work"; ViewBag.ActivePage = page; int totalPage; Entities.Concrete.Task task = _taskService.GetTaskWithUrgent(id); var userList = _appUserService.GetUserWithoutAdmin(out totalPage, s, page); ViewBag.TotalPage = totalPage; ViewBag.Searched = s; var userListDto = _mapper.Map <List <ListAppUserDto> >(userList); ViewBag.Personels = userListDto; var taskModel = _mapper.Map <ListTaskDto>(task); return(View(taskModel)); }