public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Desc,ExtraBeds,View,IsBalcony,BasicPrice,ImgUrl")] RoomType roomType) { if (id != roomType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roomType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomTypeExists(roomType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(roomType)); }
public async Task <IActionResult> Edit(int id, [Bind("RoomId,OrderId")] RoomsOrders roomsOrders) { if (id != roomsOrders.RoomId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roomsOrders); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomsOrdersExists(roomsOrders.RoomId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["OrderId"] = new SelectList(_context.Order, "Id", "ClientID", roomsOrders.OrderId); ViewData["RoomId"] = new SelectList(_context.Room, "Id", "Id", roomsOrders.RoomId); return(View(roomsOrders)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Type,IsTwinBed,Floor,IsAvailable")] Room room) { if (HttpContext.Session.GetString("Name") == null) { return(RedirectToAction("Login", "Workers")); } if (id != room.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(room); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomExists(room.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(room)); }
public async Task <IActionResult> Edit(string id, [Bind("Tz,Name,PhoneNumber,Address,Email")] Client client) { if (id != client.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(client); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(client.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(client)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FromDate,ToDate,NumOfAdults,NumOfKids,NumOfInfants,TotalPrice")] Order order) { if (id != order.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } if (HttpContext.Session.GetString("Name") == null) { return(RedirectToAction("Login", "Workers")); } return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,WorkerId,Name,PhoneNumber,Email,WorkerType")] Worker worker) { if (id != worker.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(worker); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkerExists(worker.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(worker)); }