public async Task UpdateAsync(int id, AdminRestaurantModel model)
        {
            var rest = await GetRestaurantWithIncludesAsync(id);

            rest = _mapper.Map(model, rest);

            await AddCuisines(rest.Id, rest.Cuisines, model.Cuisines);
            await AddDeliveries(rest.Id, rest.Deliveries, model.DeliveryTypes);
            await AddManagers(rest.Id, rest.Managers, model.Managers);

            await SetWidgetType(model.IsNew, rest.IsNew, id, WidgetType.New);
            await SetWidgetType(model.IsPopular, rest.IsPopular, id, WidgetType.Popular);
            await SetWidgetType(model.FreeDelivery, rest.FreeDelivery, id, WidgetType.FreeDelivery);

            await _context.SaveChangesAsync();
        }
        public async Task <SuccessResponseModel> AddAsync(AdminRestaurantModel model)
        {
            RestaurantEntity rest = _mapper.Map <RestaurantEntity>(model);

            await _context.Restaurants.AddAsync(rest);

            await _context.SaveChangesAsync();

            await AddCuisines(rest.Id, rest.Cuisines, model.Cuisines);
            await AddDeliveries(rest.Id, rest.Deliveries, model.DeliveryTypes);
            await AddManagers(rest.Id, rest.Managers, model.Managers);

            await SetWidgetType(model.IsNew, rest.IsNew, rest.Id, WidgetType.New);
            await SetWidgetType(model.IsPopular, rest.IsPopular, rest.Id, WidgetType.Popular);
            await SetWidgetType(model.FreeDelivery, rest.FreeDelivery, rest.Id, WidgetType.FreeDelivery);

            await _context.SaveChangesAsync();

            return(new SuccessResponseModel {
                Id = rest.Id
            });
        }
        public async Task <IActionResult> Add([FromBody] AdminRestaurantModel model)
        {
            SuccessResponseModel result = await _restaurantService.AddAsync(model);

            return(Ok(result));
        }
        public async Task <IActionResult> Update([FromRoute] int id, [FromBody] AdminRestaurantModel model)
        {
            await _restaurantService.UpdateAsync(id, model);

            return(Ok());
        }