public async Task <IActionResult> Create([Bind("Title,ReleaseDate,Genre,Price,Rating,ID")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Create([Bind("AvatarImage,Name,Email,MobilePhone,Status,ID")] ApplicationUser applicationUser) { if (ModelState.IsValid) { _context.Add(applicationUser); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(applicationUser)); }
public async Task <IActionResult> Create([Bind("ListingId,Name,StartingBidAmount,AuctionStartTime,AuctionEndTime,Description,ListingImage")] AuctionItemModel auctionItemModel, IFormFile unconvertedFileUpload) { if (ModelState.IsValid) { if (unconvertedFileUpload != null) { auctionItemModel.ListingImage = await GetByteArrayFromImage(unconvertedFileUpload); } _context.Add(auctionItemModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(auctionItemModel)); }
public Task <int> Commit() => _context.SaveChangesAsync();
public Task AddAsync(TodoItem entity) { _dbContext.TodoItems.AddAsync(entity); return(_dbContext.SaveChangesAsync()); }