public async Task <IActionResult> Create([Bind("IngredientId,Name,Price")] Ingredient ingredient) { if (ModelState.IsValid) { _context.Add(ingredient); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ingredient)); }
public async Task <IActionResult> Create([Bind("PublisherId,PublisherName")] Publisher publisher) { if (ModelState.IsValid) { _context.Add(publisher); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(publisher)); }
public async Task <IActionResult> Create([Bind("DishId,Name,Description,Price,CategoryId,Active")] Dish dish) { if (ModelState.IsValid) { _context.Add(dish); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(dish)); }
public async Task <IActionResult> Create([Bind("GameTypeId,GenreName")] GameType gameType) { if (ModelState.IsValid) { _context.Add(gameType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(gameType)); }
public async Task <IActionResult> Create([Bind("CategoryId,Name,Active")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("PlatformId,PlatformName")] GamePlatform gamePlatform) { if (ModelState.IsValid) { _context.Add(gamePlatform); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(gamePlatform)); }
public async Task <IActionResult> Create([Bind("PGRatingId,Rating")] PGRating pGRating) { if (ModelState.IsValid) { _context.Add(pGRating); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pGRating)); }
public async Task <IActionResult> Create([Bind("ImageId,URL,ProductId")] Image image) { if (ModelState.IsValid) { _context.Add(image); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Product, "ProductId", "Name", image.ProductId); return(View(image)); }
public async Task <IActionResult> Create([Bind("InventoryId,Stock,Price,ProductId,PlatformId")] Inventory inventory) { if (ModelState.IsValid) { _db.Add(inventory); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PlatformId"] = new SelectList(_db.GamePlatform, "PlatformId", "PlatformName", inventory.PlatformId); ViewData["ProductId"] = new SelectList(_db.Product, "ProductId", "Name", inventory.ProductId); return(View(inventory)); }
public async Task <IActionResult> Post([FromBody] User user) { if (!string.IsNullOrEmpty(user.Name)) { _context.Add(user); await _context.SaveChangesAsync(); return(CreatedAtAction("Post", user)); } else { return(BadRequest("User's name was not given")); } }
public async Task <IActionResult> Register([Bind("UserId,Name,Surname,Street,PostalCode,Password,Birthdate,Email,CityId,RoleId")] User user) { if (ModelState.IsValid) { user.UserId = Guid.NewGuid(); user.Password = Hashing.HashPassword(user.Password); _db.Add(user); await _db.SaveChangesAsync(); return(Redirect("/Login")); } ViewData["CityId"] = new SelectList(_db.City, "CityId", "CityName", user.CityId); ViewData["RoleId"] = new SelectList(_db.UserRole, "RoleId", "RoleName", user.RoleId); return(View(user)); }