public async Task <IActionResult> Create([Bind("BackLogTaskId,Day,Hours")] BacklogTaskSchedule backlogTaskSchedule) { var allowed = await _authorizationService.AuthorizeAsync(User, BacklogItem, Operations.Update); if (!allowed.Succeeded) { return(new ForbidResult()); } if (ModelState.IsValid) { _context.Add(backlogTaskSchedule); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BackLogTaskId"] = BacklogItemTask.Id; return(View(backlogTaskSchedule)); }
public async Task <IActionResult> Edit(int id, DateTime day, [Bind("BackLogTaskId,Day,Hours")] BacklogTaskSchedule backlogTaskSchedule) { if (id != backlogTaskSchedule.BackLogTaskId) { return(NotFound()); } var allowed = await _authorizationService.AuthorizeAsync(User, BacklogItem, Operations.Update); if (!allowed.Succeeded) { return(new ForbidResult()); } if (ModelState.IsValid) { try { _context.Update(backlogTaskSchedule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BacklogTaskScheduleExists(backlogTaskSchedule.BackLogTaskId, day)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BackLogTaskId"] = backlogTaskSchedule.BackLogTaskId; return(View(backlogTaskSchedule)); }