public async Task <IActionResult> Edit(int id, [Bind("Id,TaskName,StartDate,EndDate")] DataModelEntity.Entity.Task task, [Bind("type")] string type) { if (id != task.Id) { return(NotFound()); } if (ModelState.IsValid) { try { task.TaskType = type; _context.Update(task); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskExists(task.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(task)); }
public async Task <IActionResult> Create([Bind("Id,TaskName,FileName,StartDate,EndDate")] DataModelEntity.Entity.Task task, [Bind("type")] string type, [Bind("bookUrl")] IFormFile bookUrl) { if (ModelState.IsValid) { task.FileName = Upload(bookUrl, task.FileName); task.GrupId = HarvestPlansController.CurrentGrupId; task.TaskType = type; task.SubjectId = subjectId; _context.Add(task); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(task)); }