Beispiel #1
0
 public ActionResult Edit([Bind(Include = "Id,ReportType,ShortName,CreatedOn,CreatedBy,UpdatedOn,UpdatedBy")] LookupReportType lookupReportType)
 {
     if (ModelState.IsValid)
     {
         lookupReportType.UpdatedBy       = CurrentUser.Id;
         lookupReportType.UpdatedOn       = DateTime.UtcNow;
         db.Entry(lookupReportType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CreatedBy = new SelectList(db.Users, "Id", "UserName", lookupReportType.CreatedBy);
     ViewBag.UpdatedBy = new SelectList(db.Users, "Id", "UserName", lookupReportType.UpdatedBy);
     return(View(lookupReportType));
 }
Beispiel #2
0
        // GET: Admin/ReportTypes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LookupReportType lookupReportType = db.LookupReportTypes.Find(id);

            if (lookupReportType == null)
            {
                return(HttpNotFound());
            }
            return(View(lookupReportType));
        }
Beispiel #3
0
        // GET: Admin/ReportTypes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LookupReportType lookupReportType = db.LookupReportTypes.Find(id);

            if (lookupReportType == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CreatedBy = new SelectList(db.Users, "Id", "UserName", lookupReportType.CreatedBy);
            ViewBag.UpdatedBy = new SelectList(db.Users, "Id", "UserName", lookupReportType.UpdatedBy);
            return(View(lookupReportType));
        }
Beispiel #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            LookupReportType lookupReportType = db.LookupReportTypes.Find(id);

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