コード例 #1
0
        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"));
            }
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 public void Update(restaurant_Branch restaurant_Branch)
 {
     this.data.Update(restaurant_Branch);
 }
コード例 #5
0
 public void Insert(restaurant_Branch restaurant_Branch)
 {
     this.data.Insert(restaurant_Branch);
 }
コード例 #6
0
 public void Insert(restaurant_Branch restaurant_Branch)
 {
     this.context.restaurant_Branch.Add(restaurant_Branch);
     this.context.SaveChanges();
 }