Exemple #1
0
        public ActionResult Edit(Track track)
        {
            if (ModelState.IsValid)
            {
                db.Entry(track).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", new { Area = "Admin", Id = track.DetailId }));
            }

            ViewBag.Code = new SelectList(db.Details.ToList(), "DetailId", "Name", track.DetailId);
            return(View(track));
        }
Exemple #2
0
        public ActionResult Edit(Detail detail)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    detail.CreatedDate = DateTime.Now;

                    db.Entry(detail).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index", "Home", new { Area = "Admin" }));
                }

                return(View(detail));
            }
            catch (Exception ex)
            {
                TempData["EditError"] = ex.Message;
            }
            return(View(detail));
        }