コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: Repository.cs プロジェクト: fabiojansenbr/floralist
 public Task AddDesignerAsync(Designer designer)
 {
     _flowerAppContext.Designers.Add(designer);
     return(_flowerAppContext.SaveChangesAsync());
 }