Пример #1
0
 public ActionResult Edit(Plane plane)
 {
     // Created might be lost ?
     plane.LastUpdatedTimestamp = DateTime.Now;
     plane.LastUpdatedBy = User.Pilot().ToString();
     if (ModelState.IsValid)
     {
         db.Entry(plane).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.StartTypeId = new SelectList(db.StartTypes, "StartTypeId", "ShortName", plane.StartTypeId);
     return View(plane);
 }
Пример #2
0
        public ActionResult Create(Plane plane)
        {
            plane.CreatedTimestamp = DateTime.Now;
            plane.CreatedBy = User.Pilot().ToString();
            plane.LastUpdatedTimestamp = DateTime.Now;
            plane.LastUpdatedBy = User.Pilot().ToString();
            if (ModelState.IsValid)
            {
                db.Planes.Add(plane);
                db.SaveChanges();
                return RedirectToAction("Index");  
            }

            ViewBag.StartTypeId = new SelectList(db.StartTypes, "StartTypeId", "ShortName", plane.StartTypeId);
            return View(plane);
        }