예제 #1
0
 public ActionResult Edit([Bind(Include = "Id,ProjectId,ReportNumber,ScheduledDate,PerformedDate,Auditor,Comments,BaselineId")] Audits audits)
 {
     if (ModelState.IsValid)
     {
         db.Entry(audits).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BaselineId = new SelectList(db.BaselinePlan, "Id", "Name", audits.BaselineId);
     ViewBag.ProjectId  = new SelectList(db.Project, "Id", "Name", audits.ProjectId);
     return(View(audits));
 }
 public ActionResult Edit([Bind(Include = "Id,Username,Password,Role,IsActive")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
 public ActionResult Edit([Bind(Include = "Id,ClassId,Datetime,Status")] ClassSchedule classSchedule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(classSchedule).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClassId = new SelectList(db.Classes, "Id", "Name", classSchedule.ClassId);
     return(View(classSchedule));
 }
예제 #4
0
        /// <summary>
        /// Modified the flight
        /// </summary>
        /// <param name="flight"></param>
        public virtual void Change(Flight flight)
        {
            flight.SourceAirportName      = flight.Source.Name;
            flight.DestinationAirportName = flight.Destination.Name;

            flightDomain.FlightCalculator(flight);

            EntitiesDB.Entry(flight).State = EntityState.Modified;

            EntitiesDB.SaveChanges();
        }
 public ActionResult Edit([Bind(Include = "Id,StudentId,ClassId")] Studying studying)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studying).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClassId   = new SelectList(db.Classes, "Id", "Name", studying.ClassId);
     ViewBag.StudentId = new SelectList(db.Students, "Id", "Name", studying.StudentId);
     return(View(studying));
 }
예제 #6
0
 public ActionResult Edit([Bind(Include = "Id,SubjectId,TeacherId,Name,Day,StartSession,QuantityOfSession,Room")] Class @class)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@class).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SubjectId = new SelectList(db.Subjects, "Id", "Name", @class.SubjectId);
     ViewBag.TeacherId = new SelectList(db.Teachers, "Id", "Name", @class.TeacherId);
     return(View(@class));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,PhoneNumber,Address,Email,FacultyId,UserId,Gender,Hometown,Birthday")] Teacher teacher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(teacher).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FacultyId = new SelectList(db.Faculties, "Id", "Name", teacher.FacultyId);
     ViewBag.UserId    = new SelectList(db.Users, "Id", "Username", teacher.UserId);
     return(View(teacher));
 }
예제 #8
0
        public ActionResult Edit([Bind(Include = "Id,BaselinePlanId,Values")] BaselinePlanAuditViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var baselinePlanAudit = db.BaselinePlanAudit.Find(viewModel.Id);
                baselinePlanAudit.Values         = string.Join(",", viewModel.Values);
                baselinePlanAudit.BaselinePlanId = viewModel.BaselinePlanId;
                baselinePlanAudit.Verified       = true;

                db.Entry(baselinePlanAudit).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            var projects      = db.ProjectUser.Where(pu => pu.UserName.Trim() == User.Identity.Name).Select(pu => pu.Project);
            var baselinePlans = db.BaselinePlan.Where(bp => projects.Contains(bp.Project));

            ViewBag.BaselinePlanId = new SelectList(baselinePlans, "Id", "Name", viewModel.BaselinePlanId);
            return(View(viewModel));
        }