public ActionResult AddPicture(HttpPostedFileBase myFile) { if (Session["Login"] != null && Session["Company"] != null) { gelen = (AppUsers)Session["Login"]; companybilgi = (Company)Session["Company"]; } else { return(RedirectToAction("Index", "Home", new { area = "" })); } if ((int)Session["hata"] > 0) { if (productManagement.GetProductById((int)Session["hata"]) != null && companybilgi.Products.Where(s => s.ProductID == (int)Session["hata"]).Count() > 0) { string resimyolu = ""; if (gelen.Status.Value == 2) { if (myFile != null && !string.IsNullOrEmpty(myFile.FileName)) { Guid key = Guid.NewGuid(); myFile.SaveAs(Server.MapPath("~/Files/ProductImage/" + key + myFile.FileName)); resimyolu = "/Files/ProductImage/" + key + myFile.FileName; productManagement.AddPic((int)Session["hata"], resimyolu); return(View(productManagement.getAllProductPictures((int)Session["hata"]))); } else { return(RedirectToAction("AddPicture", "AdminProductModification")); } } else { return(RedirectToAction("Index", "Admin")); } } else { return(RedirectToAction("Index", "Admin")); } } else { return(RedirectToAction("Index", "Admin")); } }