Ejemplo n.º 1
0
        public ActionResult Edit(int SN, string cosmetologyName, int price)
        {
            try
            {
                if (cosmetologyName.Equals(string.Empty))
                {
                    ModelState.AddModelError("cosmetologyName", "請輸入項目");
                }

                if (price.Equals(string.Empty))
                {
                    ModelState.AddModelError("price", "請輸入金額");
                }

                Comm_Cosmetology cosmetology = CosmetologyModel.getCosmetologyBySN(SN);

                if (!ModelState.IsValid)
                {
                    return(View(cosmetology));
                }

                cosmetology.cosmetologyName = cosmetologyName;
                cosmetology.price           = price;

                CosmetologyModel.Update(cosmetology);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 2
0
        // GET: Cosmetology
        public ActionResult Index(int page = 1, int pageSize = 10)
        {
            List <Comm_Cosmetology> cosmetology = CosmetologyModel.getCosmetologyList();
            var result = cosmetology.OrderBy(o => o.SN).ToPagedList();

            return(View(result));
        }
Ejemplo n.º 3
0
        // GET: Cosmetology/Edit/5
        public ActionResult Edit(int?SN)
        {
            if (SN == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Comm_Cosmetology cosmetology = CosmetologyModel.getCosmetologyBySN(Convert.ToInt32(SN));

            return(View(cosmetology));
        }
Ejemplo n.º 4
0
        public ActionResult Checkout(int petSN)
        {
            Vw_Pet pet = PetModel.getVwPetBySN(petSN);
            List <Comm_Cosmetology> cosmetologyList = CosmetologyModel.getCosmetologyList();

            ViewBag.cosmetologySN = new SelectList(cosmetologyList, "SN", "cosmetologyName");
            ViewBag.pet           = pet;

            return(View(pet));
        }
Ejemplo n.º 5
0
        public string getCosmetologyPrice(int SN)
        {
            string price = CosmetologyModel.getCosmetologyBySN(SN).price.ToString();

            return(price);
        }