public async Task <IActionResult> TaskCreate(CreateTaskWebModel taskModel) { try { string userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); TaskServiceModel taskServiceModel = new TaskServiceModel { Id = Guid.NewGuid().ToString(), Name = taskModel.Name, Description = taskModel.Description, Budget = taskModel.Budget, DueDate = taskModel.DueDate, LocationId = taskModel.SelectedLocationId, TaskCategoryId = taskModel.SelectedTaskCategoryId, IssuerId = userId }; await this._taskService.CreateAsync(taskServiceModel, userId); return(RedirectToAction(nameof(Tasks))); } catch { return(View()); } }
public async Task <IActionResult> TaskCreate() { CreateTaskWebModel createTaskWebModel = new CreateTaskWebModel { Locations = await this._locationService.GetAllAsync(), TaskCategories = await this._taskService.GetAllTaskCtagories() }; return(View(createTaskWebModel)); }
// GET: TaskController/Create public async Task <IActionResult> Create() { string userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); CreateTaskWebModel createTaskWebModel = new CreateTaskWebModel { Locations = await this._locationService.GetAllAsyncOfUser(userId), TaskCategories = await this._taskService.GetAllTaskCtagories() }; return(View(createTaskWebModel)); }