예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            DefLandlord defLandlord = db.DefLandlords.Find(id);

            db.DefLandlords.Remove(defLandlord);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "ID,LandlordName,WebSite,Email,Address,Industry,FK_CreatorID,CreationDate,LastModifiedDate")] DefLandlord defLandlord)
 {
     if (ModelState.IsValid)
     {
         db.Entry(defLandlord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(defLandlord));
 }
예제 #3
0
        // GET: DefLandlords/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DefLandlord defLandlord = db.DefLandlords.Find(id);

            if (defLandlord == null)
            {
                return(HttpNotFound());
            }
            return(View(defLandlord));
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "ID,LandlordName,WebSite,Email,Address,Industry,FK_CreatorID,CreationDate,LastModifiedDate")] DefLandlord defLandlord)
        {
            if (ModelState.IsValid)
            {
                defLandlord.FK_CreatorID = User.Identity.GetUserId();
                DateTime nowTimestamp = DateTime.Now;
                defLandlord.CreationDate     = nowTimestamp;
                defLandlord.LastModifiedDate = nowTimestamp;

                db.DefLandlords.Add(defLandlord);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(defLandlord));
        }