Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AspNetBusiness aspNetBusiness = db.AspNetBusinesses.Find(id);

            db.AspNetBusinesses.Remove(aspNetBusiness);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "id,Name,Value,Address")] AspNetBusiness aspNetBusiness)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aspNetBusiness).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aspNetBusiness));
 }
Beispiel #3
0
        // GET: Business/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AspNetBusiness aspNetBusiness = db.AspNetBusinesses.Find(id);

            if (aspNetBusiness == null)
            {
                return(HttpNotFound());
            }
            return(View(aspNetBusiness));
        }
Beispiel #4
0
        public ActionResult Create([Bind(Include = "Name,Value,Address")] AspNetBusiness aspNetBusiness)
        {
            if (ModelState.IsValid)
            {
                db.AspNetBusinesses.Add(aspNetBusiness);
                db.AspNetBusinessUsers.Add(new AspNetBusinessUser
                {
                    UserId     = User.Identity.GetUserId(),
                    BusinessId = aspNetBusiness.id
                });
                db.SaveChanges();
                return(RedirectToAction("/Details/" + aspNetBusiness.id));
            }

            return(View(aspNetBusiness));
        }