public async Task <RestaurantDto> AddRestaurant(CreateRestaurantDto input)//add restaurant { var restaurant = Restaurant.Create(input.Name, input.Address); var result = await _repository.AddAsync(restaurant); return(_mapper.Map <Restaurant, RestaurantDto>(result)); }
public ActionResult CreateRestaurant([FromBody] CreateRestaurantDto dto) { var userId = int.Parse(User.FindFirst(c => c.Type == ClaimTypes.NameIdentifier).Value); var id = _restaurantService.Create(dto); return(Created($"/api/restaurant/{id}", null)); }
public int Create(CreateRestaurantDto dto) { var restaurant = _mapper.Map <Restaurant>(dto); _dbContext.Restaurants.Add(restaurant); _dbContext.SaveChanges(); return(restaurant.Id); }
public int Create(CreateRestaurantDto dto) { var restaurant = _mapper.Map <Restaurant>(dto); restaurant.CreatedById = _userContextService.GetUserId; _dbContext.Restaurants.Add(restaurant); _dbContext.SaveChanges(); return(restaurant.Id); }
public ActionResult CreateRestaurant([FromBody] CreateRestaurantDto dto) { int restaurantId = _restaurantService.Create(dto); return(Created($"/api/restaurant/{restaurantId}", null)); }
public ActionResult CreateRestaurant([FromBody] CreateRestaurantDto dto) { var id = _restaurantService.Create(dto); return(Created($"api/restaurant/{id}", null)); }