public ActionResult AddBranch() { if (Session["UserName"].ToString() == "admin") { if (Request.Form["branchAddBtn"] != null) { restaurant_Branch branch = new restaurant_Branch(); branch.branchName = Request.Form["restName"]; branch.branchAddress = Request.Form[""]; branch.branchArea = Request.Form["AreaName"]; branch.branchMap = Request.Form["mapName"]; branch.branchOpenHour = Request.Form["openName"]; branch.branchCloseHour = Request.Form["closeName"]; branch.restaurantID = Convert.ToInt32(Request.Form["restID"]); branch.branchPhoneNumber = Request.Form["contactName"]; branchs.Insert(branch); return(RedirectToAction("showBranches", "AdminRestaurant", new { id = Convert.ToInt32(Request.Form["restID"]) })); } else { return(RedirectToAction("Index", "Admin")); } } else { return(RedirectToAction("Index", "Home")); } }
public void Delete(int restaurantID) { restaurant_Branch branch = this.context.restaurant_Branch.SingleOrDefault(x => x.Id == restaurantID); this.context.restaurant_Branch.Remove(branch); this.context.SaveChanges(); }
public void Update(restaurant_Branch restaurantBranch) { restaurant_Branch branch = this.context.restaurant_Branch.SingleOrDefault(x => x.Id == restaurantBranch.Id); branch.branchName = restaurantBranch.branchName; this.context.SaveChanges(); }
public void Update(restaurant_Branch restaurant_Branch) { this.data.Update(restaurant_Branch); }
public void Insert(restaurant_Branch restaurant_Branch) { this.data.Insert(restaurant_Branch); }
public void Insert(restaurant_Branch restaurant_Branch) { this.context.restaurant_Branch.Add(restaurant_Branch); this.context.SaveChanges(); }