Example #1
0
        public async Task <ActionResult> Edit(int id, RestaurantViewModel model)
        {
            try
            {
                if (Session["roleId"] == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                if (Session["roleId"].ToString() != "1")
                {
                    return(RedirectToAction("Index", "Home"));
                }

                var res = model.Restaurant;
                res.Id       = id;
                res.Category = await _proxy.GetRestaurantCategoryAsync(model.SelectedCategoryId);

                await _proxy.UpdateRestaurantAsync(res);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
            }
        }