コード例 #1
0
 public string AddSellingPoint([Bind(Include = "Address,ShawarmaTitle")] SellingPoint sellingPoint)
 {
     return(DatabaseQueries.AddSellingPoint(sellingPoint.ShawarmaTitle, sellingPoint.Address,
                                            Request.Form["SellingPointCategory"])
         ? "Success"
         : "Error");
 }
コード例 #2
0
        public void Create(DalSellingPoint e)
        {
            var SellingPoint = new SellingPoint()
            {
                SellingPointID         = e.Id,
                Address                = e.Address,
                ShawarmaTitile         = e.ShawarmaTitile,
                SellingPointCategoryID = e.SellingPointCategoryID
            };

            Context.Set <SellingPoint>().Add(SellingPoint);
        }
コード例 #3
0
        public async Task <ActionResult> Create([Bind(Include = "SellingPointId,Address,SellingPointCategory,ShawarmaTitle")] SellingPoint sellingPoint)
        {
            if (ModelState.IsValid)
            {
                db.SellingPoints.Add(sellingPoint);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.SellingPointCategory = new SelectList(db.SellingPointCategories, "SellingPointCategoryId", "SellingPointCategoryName", sellingPoint.SellingPointCategory);
            return(View(sellingPoint));
        }
コード例 #4
0
        // GET: SellingPoints/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SellingPoint sellingPoint = await db.SellingPoints.FindAsync(id);

            if (sellingPoint == null)
            {
                return(HttpNotFound());
            }
            return(View(sellingPoint));
        }
コード例 #5
0
        public void Update(DalSellingPoint e)
        {
            var SellingPoint = new SellingPoint()
            {
                SellingPointID         = e.Id,
                Address                = e.Address,
                ShawarmaTitile         = e.ShawarmaTitile,
                SellingPointCategoryID = e.SellingPointCategoryID
            };

            SellingPoint = Context.Set <SellingPoint>().Single(i => i.SellingPointID == e.Id);

            SellingPoint.Address                = e.Address;
            SellingPoint.ShawarmaTitile         = e.ShawarmaTitile;
            SellingPoint.SellingPointCategoryID = e.SellingPointCategoryID;
        }