public async Task <IActionResult> Forward(int?id) { if (id == null) { return(NotFound()); } var bill = await _context.Bill.FindAsync(id); bill.Bill_Status = 2; _context.Update(bill); _context.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <IActionResult> Edit(int id, [Bind("Fac_ID,Fac_Name,Fac_Address,Fac_Phone,Fac_Desc,Fac_Latitude,Fac_Longitude,Fac_Rating,Fac_Img")] Facility facility) { if (id != facility.Fac_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(facility); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FacilityExists(facility.Fac_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(facility)); }
public async Task <IActionResult> Edit(int id, [Bind("Service_ID,Service_Name,Service_Price,Service_Desc,Service_Dur,Service_Img")] Service service) { if (id != service.Service_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(service); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceExists(service.Service_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(service)); }
public async Task <IActionResult> Edit(int id, [Bind("Feature_ID,Feature_Name,Feature_Icon")] Feature feature) { if (id != feature.Feature_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(feature); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeatureExists(feature.Feature_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(feature)); }
public async Task <IActionResult> Edit(string id, [Bind("Cus_ID,User_ID,Cus_Name,Cus_Gender,Cus_Address,Cus_Email,Cus_Birth,Cus_Phone")] Customer customer) { if (id != customer.Cus_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.Cus_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("Room_ID,RoomType_ID,Fac_ID,Room_Status,Room_Img")] Room room) { if (id != room.Room_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(room); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomExists(room.Room_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(room)); }
public async Task <IActionResult> Edit(int id, [Bind("RoomType_ID,RoomType_Name,RoomType_MaxCusNum,RoomType_Size,RoomType_Price,RoomType_Desc,RoomType_FTList")] RoomType roomType) { if (id != roomType.RoomType_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roomType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomTypeExists(roomType.RoomType_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(roomType)); }
public async Task <IActionResult> Confirm(string fullname, string gender, string id, string email, string birthday, string address, string phone) { string userid = Guid.NewGuid().ToString().Substring(0, 15); string userpass = Guid.NewGuid().ToString().Substring(0, 15); UserAcc useracc = new UserAcc { User_ID = userid, User_Pass = userpass, User_Role = 3 }; _context.Add(useracc); await _context.SaveChangesAsync(); Customer customer = new Customer { Cus_Address = address, Cus_Birth = DateTime.ParseExact(birthday, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture), Cus_Email = email, Cus_Gender = gender, Cus_ID = id, Cus_Name = fullname, Cus_Phone = phone, User_ID = userid }; var flag = await _context.Customer.Where(p => p.Cus_ID == id).CountAsync(); if ((int)flag > 0) { _context.Update(customer); } else { _context.Add(customer); } HttpContext.Session.SetString("cusName", fullname); HttpContext.Session.SetString("cusEmail", email); HttpContext.Session.SetString("cusPhone", phone); HttpContext.Session.SetString("cusAddress", address); double discount = 0; if (HttpContext.Session.GetInt32("Voucher") != null) { discount = (double)HttpContext.Session.GetInt32("Voucher"); } double grandtotal = (HttpContext.Session.GetInt32("GrandTotal") ?? 0); ViewBag.GrandTotal = (grandtotal * (double)((100 - discount) / 100)).ToString("C0", new CultureInfo("vi-vn")); ViewBag.VValue = discount; HttpContext.Session.SetString("CusID", customer.Cus_ID); await _context.SaveChangesAsync(); return(View(customer)); }