بله در متد پست قرار دادم
ببینین کل کد من بصورت زیر هست که اگر اپلود عکس رو حذف کنم ریدایرکت انجام میشه در غیر اینصورت اتفاقی صورت نمیگیره
[HttpPost]
public ActionResult AddFood(AddFoodViewModel model, HttpPostedFileBase UploadImage)
{
List<System.Web.Mvc.SelectListItem> items = new List<System.Web.Mvc.SelectListItem>();
if (ModelState.IsValid)
{
model.Food.Image = UploadImage.FileName;
string path = Server.MapPath("~") + "FoodImages\\" + UploadImage.FileName;
UploadImage.InputStream.ResizeImageByWidth(500, path, Utility.ImageComperssion.Normal);
db.Foods.Add(model.Food);
db.SaveChanges();
items = model.List;
foreach (var item in items)
{
// if (item.Selected)
// {
int idstuf = Convert.ToInt32(item.Value);
int idfood = model.Food.Id;
db.AddFoodStuff(idstuf, idfood);
// }
}
// return MessageBox.Show("محصول با موفقیت ثبت شد", MessageType.Success);
return RedirectToAction("AddStuffAmount","Admin", new { foodid=model.Food.Id});
}
else
{
return View();
}
}