public IActionResult Index()
 {
     try
     {
         List <RestaurantModel> models = _restaurantServices.GetAllRestaurants();
         return(View(models));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
        public HttpResponseMessage GetAllRestaurants()
        {
            var restaurants = _restaurantServices.GetAllRestaurants();

            if (restaurants != null)
            {
                var restaurantEntities = restaurants.ToList();
                if (restaurantEntities.Any())
                {
                    // Map this to a model so we are only sending certain info to the requestor.  Password Hash and Salt not sent to requestor for security reasons.
                    Mapper.Initialize(cfg => { cfg.CreateMap <RestaurantEntity, RestaurantModel>(); cfg.CreateMap <RestaurantTypeEntity, RestaurantTypeModel>(); });
                    var restaurantModel = Mapper.Map <List <RestaurantEntity>, List <RestaurantModel> >(restaurantEntities);
                    return(Request.CreateResponse(HttpStatusCode.OK, restaurantModel));
                }
            }

            return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Restaurants not found."));
        }