public IHttpActionResult Post([FromBody] ViewModels.Restaurant restaurantRequest)
        {
            try
            {
                if (restaurantRequest == null)
                {
                    return(BadRequest());
                }

                var tran = Factory.CreateAddRestraurantTransaction(restaurantRequest.Name, restaurantRequest.CuisineId);
                tran.Execute();

                if (tran.Response.WasSucessfull)
                {
                    restaurantRequest.Id          = tran.Response.RestaurantId;
                    restaurantRequest.CuisineName = tran.Response.CuisineName;
                    return(CreatedAtRoute("DefaultRouting", new { id = restaurantRequest.Id }, restaurantRequest));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (RestaurantAlreadyExistsException) { return(BadRequest()); }
            catch (Exception ex)
            {
                Logger.ErrorLog($"Web API failed add new restaurant {restaurantRequest}", ex);
                return(InternalServerError());
            }
        }
        public IHttpActionResult Patch(int id, [FromBody] ViewModels.Restaurant restaurant)
        {
            try
            {
                if (restaurant == null)
                {
                    return(BadRequest());
                }

                var tran = Factory.CreatePartialUpdateRestraurantTransaction(id, restaurant.Name, restaurant.CuisineId);
                tran.Execute();

                if (tran.Response.WasSucessfull)
                {
                    return(Ok(new ViewModels.Restaurant {
                        Id = id
                    }));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (RestaurantNotFoundException) { return(NotFound()); }
            catch (RestaurantInvalidInputException) { return(BadRequest()); }
            catch (Exception ex)
            {
                Logger.ErrorLog($"Web API failed add new restaurant {restaurant}", ex);
                return(InternalServerError());
            }
        }