public ActionResult Edit([Bind(Include = "StaffNumber,calId")] ProjectSupervisor projectSupervisor) { if (ModelState.IsValid) { db.Entry(projectSupervisor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StaffNumber = new SelectList(db.AspNetUsers, "Id", "Email", projectSupervisor.UserID); return(View(projectSupervisor)); }
public ActionResult Edit([Bind(Include = "StudentNumber,StaffNumber,Id")] Allocation allocation) { if (ModelState.IsValid) { db.Entry(allocation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StaffNumber = new SelectList(db.ProjectSupervisors, "UserID", "UserID", allocation.StaffNumber); ViewBag.StudentNumber = new SelectList(db.Students, "UserID", "Course", allocation.StudentNumber); return(View(allocation)); }
public ActionResult Edit([Bind(Include = "StudentNumber,Course,StudyYear,ProjectName")] Student student) { using (ProgressTrackerEntities dc = new ProgressTrackerEntities()) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StudentNumber = new SelectList(db.AspNetUsers, "Id", "Email", student.UserID); return(View(student)); } }
public IHttpActionResult EditLink(int id, LinkDto linkDto) { using (var dc = new ProgressTrackerEntities()) { var clientLink = (Link)linkDto; clientLink.LinkId = id; dc.Entry(clientLink).State = EntityState.Modified; dc.SaveChanges(); return(Ok(new { action = "updated" })); } }
public ActionResult Edit([Bind(Include = "MilestoneID,Text,StartDate,Duration,ProjectNumber,Type,ParentId,Progress,Id,StudentNumber")] Milestone milestone) { var userID = User.Identity.GetUserId(); using (var db = new ProgressTrackerEntities()) { if (ModelState.IsValid) { milestone.StudentNumber = userID; db.Entry(milestone).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } ViewBag.MilestoneID = new SelectList(db.Students, "StudentNumber", "Course", milestone.MilestoneID); return(View(milestone)); }
public IHttpActionResult EditTask(int id, TaskDto taskDto) { var userID = User.Identity.GetUserId(); Completed completed = new Completed(); To_Do to_Do = new To_Do(); using (var dc = new ProgressTrackerEntities()) { var updatedTask = (Milestone)taskDto; updatedTask.Id = id; if (taskDto.progress == 1) { updatedTask.Status = "Completed"; completed.Progress = updatedTask.Progress; completed.StudentNumber = updatedTask.StudentNumber; dc.Completeds.Add(completed); dc.SaveChanges(); } else if (taskDto.progress == 0) { updatedTask.Status = "To-Do"; to_Do.StudentNumber = updatedTask.StudentNumber; to_Do.Progress = updatedTask.Progress; dc.To_Do.Add(to_Do); dc.SaveChanges(); } else { updatedTask.Status = "In-Progress"; } dc.Entry(updatedTask).State = EntityState.Modified; dc.SaveChanges(); return(Ok(new { action = "updated" })); } }