public async Task <IActionResult> Create([Bind("CustomerId,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <int> Handle(CreateRoomCommand request, CancellationToken cancelationToken) { var entity = new Room { Calendar = request.Calendar, Number = request.Calendar, Price = request.Price }; _context.Add(entity); await _context.SaveChangesAsync(cancelationToken); return(entity.RoomId); }
public virtual TEntity Add(TEntity entity) { _dbContext.Add(entity); _dbContext.SaveChanges(); return(entity); }
private void AddCustomer(Customer customer) { _context.Add(customer); _context.SaveChanges(); }