public async Task <IActionResult> Create([Bind("Id,Name,Email,PhoneNumber")] Customer customer) { if (ModelState.IsValid) { var designer = _context.Designers.FirstOrDefault(m => m.UserId == User.GetUserId()); customer.DesignerId = designer.Id; customer.IsActive = true; _context.Customers.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public Task AddDesignerAsync(Designer designer) { _flowerAppContext.Designers.Add(designer); return(_flowerAppContext.SaveChangesAsync()); }