コード例 #1
0
 public ActionResult Edit([Bind(Include = "Id,RxPlanType,CreatedOn,CreatedBy,UpdatedOn,UpdatedBy")] LookupRxcPlanType lookupRxcPlanType)
 {
     if (ModelState.IsValid)
     {
         lookupRxcPlanType.UpdatedBy       = CurrentUser.Id;
         lookupRxcPlanType.UpdatedOn       = DateTime.UtcNow;
         db.Entry(lookupRxcPlanType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CreatedBy = new SelectList(db.Users, "Id", "UserName", lookupRxcPlanType.CreatedBy);
     ViewBag.UpdatedBy = new SelectList(db.Users, "Id", "UserName", lookupRxcPlanType.UpdatedBy);
     return(View(lookupRxcPlanType));
 }
コード例 #2
0
        // GET: Admin/RxcPlanTypes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LookupRxcPlanType lookupRxcPlanType = db.LookupRxcPlanTypes.Find(id);

            if (lookupRxcPlanType == null)
            {
                return(HttpNotFound());
            }
            return(View(lookupRxcPlanType));
        }
コード例 #3
0
        // GET: Admin/RxcPlanTypes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LookupRxcPlanType lookupRxcPlanType = db.LookupRxcPlanTypes.Find(id);

            if (lookupRxcPlanType == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CreatedBy = new SelectList(db.Users, "Id", "UserName", lookupRxcPlanType.CreatedBy);
            ViewBag.UpdatedBy = new SelectList(db.Users, "Id", "UserName", lookupRxcPlanType.UpdatedBy);
            return(View(lookupRxcPlanType));
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            LookupRxcPlanType lookupRxcPlanType = db.LookupRxcPlanTypes.Find(id);

            try
            {
                db.LookupRxcPlanTypes.Remove(lookupRxcPlanType);
                db.SaveChanges();
            }
            catch (DbUpdateException ex)
            {
                ModelState.AddModelError("Error", "There are some releted item in database, please delete those first");
                return(View("Delete", lookupRxcPlanType));
            }
            return(RedirectToAction("Index"));
        }