public ActionResult <IEnumerable <TableDto> > CreateTableForRestaurant(
            [FromRoute] int restaurantId,
            [FromBody] TableCreationDto tableCreationDto)
        {
            var table = this.Mapper.Map <Table>(tableCreationDto);

            this.RestaurantRepository.AddTableForRestaurant(restaurantId, table);

            return(Ok(this.Mapper.Map <TableDto>(table)));
        }
示例#2
0
 public IActionResult AddTable([FromBody] TableCreationDto table)
 {
     try
     {
         Table t            = _mapper.Map <Table>(table);
         Table createdTable = _tablesService.AddTable(t);
         return(CreatedAtRoute("GetTable", new { id = createdTable.Id }, createdTable));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }