Beispiel #1
0
        public async Task <IActionResult> Create([Bind("id,adress,kitchen,name,spec,string_id")] Restaurants restaurants)
        {
            if (ModelState.IsValid)
            {
                _context.Add(restaurants);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(restaurants));
        }
Beispiel #2
0
        public async Task CreateRequestForCommandAsync <T>(Guid id)
        {
            var exists = await ExistAsync(id);

            var request = exists
                ? throw new DeliveryDomainException($"Request with {id} already exists")
                : new ClientRequest
                                {
                                    Id   = id,
                                    Name = typeof(T).Name,
                                    Time = DateTime.UtcNow
                                };

            _context.Add(request);

            await _context.SaveChangesAsync();
        }