// GET: Food/Create public ActionResult Create() { Models.FoodModel foodModel = new Models.FoodModel { Allergies = _proxy.GetAllAllergies().ToList() }; return(View(foodModel)); }
public ActionResult TakeFood(Models.FoodModel model) { var model2 = new ServiceReference1.FoodModel { GuidLine = model.Guid }; var email = Request.Cookies.Get("login").Values["feketePorzeczka"]; _proxy.TakeFood(model2, email); return(RedirectToAction("Take")); }
public ActionResult Delete(Models.FoodModel food) { try { if (!ModelState.IsValid) { return(View("Index")); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(Models.FoodModel food) { try { if (!ModelState.IsValid) { return(View("Create", food)); } string fileName = food.files[0].FileName; string guid = Guid.NewGuid().ToString(); System.IO.Directory.CreateDirectory(Server.MapPath($"~/App_Data/{guid}")); food.files[0].SaveAs(Server.MapPath($"~/App_Data/{guid}/{fileName}")); _proxy.AddFood(new ServiceReference1.FoodModel { ExpDate = food.ExpDate, Description = food.Description, PhotoPath = fileName, GuidLine = guid, Allergies = food.SelectedAllergies }, Request.Cookies.Get("login").Values["feketePorzeczka"]); return(RedirectToAction("Index", "User", "")); } catch { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); } }