// GET: Project/Delete/5 public async Task <IActionResult> Delete(int?id) { var project = await db.Projects.FindAsync(id); db.Projects.Remove(project); await db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Index(ProjectTask task) { if (ModelState.IsValid) { ProjectTask projectTask = new ProjectTask { TaskName = task.TaskName, PercentageOfProject = task.PercentageOfProject, ProjectId = task.ProjectId }; db.Tasks.Add(projectTask); await db.SaveChangesAsync(); } return(RedirectToAction("Info", "CurrentProject", new { projectId = task .ProjectId })); }
// GET: Project/Delete/5 public async Task <IActionResult> DeleteTask(int?id) { var task = await hAPPAN_MVC_AuthDBContext.Tasks.FindAsync(id); var projectid = task.ProjectId; hAPPAN_MVC_AuthDBContext.Tasks.Remove(task); await hAPPAN_MVC_AuthDBContext.SaveChangesAsync(); return(RedirectToAction("Info", "CurrentProject", new { projectId = projectid })); }
public async Task <IActionResult> Index([Bind("ProjectId,ProjectName,Status")] Project Projects) { if (ModelState.IsValid) { if (Projects.ProjectId == 0) { hAPPAN_MVC_AuthDBContext.Add(Projects); } else { hAPPAN_MVC_AuthDBContext.Update(Projects); } await hAPPAN_MVC_AuthDBContext.SaveChangesAsync(); return(RedirectToAction("Index", "Home")); } return(View(Projects)); }