public async Task <IActionResult> Create([Bind("IdAddress,Country,City,Number")] Address address) { if (ModelState.IsValid) { _context.Add(address); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(address)); }
public async Task <IActionResult> Create([Bind("IdRating,HostRate,Communication,Location,Value,Accuracy,Cleanliness")] Rating rating) { if (ModelState.IsValid) { _context.Add(rating); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(rating)); }
public async Task <IActionResult> Create([Bind("IdRent,CheckIn,CheckOut")] Rent rent) { if (ModelState.IsValid) { _context.Add(rent); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(rent)); }
public async Task <IActionResult> Create([Bind("IdSpecs,Created,Updated,Description,Amenities")] Spec spec) { if (ModelState.IsValid) { _context.Add(spec); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(spec)); }
public async Task <IActionResult> Create([Bind("IdRole,Name,Activity")] Role role) { if (ModelState.IsValid) { _context.Add(role); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(role)); }
public async Task <IActionResult> Create([Bind("IdDevice,DeviceName,Description")] Device device) { if (ModelState.IsValid) { _context.Add(device); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(device)); }
public async Task <IActionResult> Create([Bind("IdPlace,AddressId,Description,Price,Availability,Rooms,MaxOfGuests")] Place place) { if (ModelState.IsValid) { _context.Add(place); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AddressId"] = new SelectList(_context.Addresses, "IdAddress", "IdAddress", place.AddressId); return(View(place)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Username,Password,Email,Created,LastUpdate,LastLog,IdDevice")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdDevice"] = new SelectList(_context.Devices, "IdDevice", "DeviceName", user.IdDevice); return(View(user)); }
public async Task <IActionResult> Create([Bind("IdURole,IdUser,IdRole")] UserRole userRole) { if (ModelState.IsValid) { _context.Add(userRole); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdRole"] = new SelectList(_context.Roles, "IdRole", "Name", userRole.IdRole); return(View(userRole)); }
public async Task <IActionResult> Create([Bind("IdReview,OfferId,UserRoleId,Date,RatingId,Comment")] Review review) { if (ModelState.IsValid) { _context.Add(review); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OfferId"] = new SelectList(_context.Offers, "IdOffer", "IdOffer", review.OfferId); ViewData["RatingId"] = new SelectList(_context.Ratings, "IdRating", "IdRating", review.RatingId); return(View(review)); }
public async Task <IActionResult> Create([Bind("IdOffer,PlaceId,RentId,UserRoleId,Date")] Offer offer) { if (ModelState.IsValid) { _context.Add(offer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PlaceId"] = new SelectList(_context.Places, "IdPlace", "IdPlace", offer.PlaceId); ViewData["RentId"] = new SelectList(_context.Rents, "IdRent", "IdRent", offer.RentId); ViewData["UserRoleId"] = new SelectList(_context.UserRoles, "IdURole", "IdURole", offer.UserRoleId); return(View(offer)); }