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()); } }
// 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)); }
// 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)); }
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)); }
public string getCosmetologyPrice(int SN) { string price = CosmetologyModel.getCosmetologyBySN(SN).price.ToString(); return(price); }