public ActionResult Edit([Bind(Include = "TaskId,SprintId,TaskName,TaskDescription,IsDone")] TaskEditModel task)
        {
            if (!ModelState.IsValid)
            {
                return(View(task));
            }

            var taskEntity = db.Task.FirstOrDefault(x => x.TaskId == task.TaskId);

            if (taskEntity == null)
            {
                return(HttpNotFound());
            }

            taskEntity.SprintId        = task.SprintId;
            taskEntity.TaskName        = task.TaskName;
            taskEntity.TaskDescription = task.TaskDescription;
            taskEntity.IsDone          = task.IsDone;

            db.Entry(taskEntity).State = EntityState.Modified;
            db.SaveChanges();

            ViewBag.SprintId = new SelectList(db.Sprint, "SprintId", "SprintId", task.SprintId);
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "ReleaseId,ProjectId,ReleaseDate,ReleaseName,ReleaseDescription,ServerName")] Release release)
 {
     if (ModelState.IsValid)
     {
         db.Entry(release).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProjectId = new SelectList(db.Project, "ProjectId", "ProjectName", release.ProjectId);
     return(View(release));
 }
        public ActionResult Edit([Bind(Include = "ProjectId,ProjectName,ProjectDescription,ProjectDeadline")] ProjectEditModel project)
        {
            if (!ModelState.IsValid)
            {
                return(View(project));
            }
            var projectEntity = db.Project.FirstOrDefault(x => x.ProjectId == project.ProjectId);

            if (projectEntity == null)
            {
                return(HttpNotFound());
            }

            projectEntity.ProjectName        = project.ProjectName;
            projectEntity.ProjectDeadline    = project.ProjectDeadline;
            projectEntity.ProjectDescription = project.ProjectDescription;

            db.Entry(projectEntity).State = EntityState.Modified;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit([Bind(Include = "SprintId,ProjectId,SprintStart,SpintEnd")] SprintEditModel sprint)
        {
            if (!ModelState.IsValid)
            {
                return(View(sprint));
            }

            var sprintEntity = db.Sprint.FirstOrDefault(x => x.SprintId == sprint.SprintId);

            if (sprintEntity == null)
            {
                return(HttpNotFound());
            }

            sprintEntity.ProjectId   = sprint.ProjectId;
            sprintEntity.SprintStart = sprint.SprintStart;
            sprintEntity.SpintEnd    = sprint.SpintEnd;

            db.Entry(sprintEntity).State = EntityState.Modified;
            db.SaveChanges();

            ViewBag.ProjectId = new SelectList(db.Project, "ProjectId", "ProjectName", sprint.ProjectId);
            return(RedirectToAction("Index"));
        }