//Uploading Files //public List<HttpPostedFileBase> PostedPhotos = new List<HttpPostedFileBase>(); public JsonResult UploadingFiles(InsertProduct FormData) { InsertProduct data = new InsertProduct(); DashboardCloth dashboard = new DashboardCloth(); data = FormData; bool result = false; try { if (data.Files != null && data.Files.ContentLength > 0) { var fileName = Path.GetFileName(data.Files.FileName); //string filename = System.IO.Path.GetFileName(file.FileName); //file.SaveAs(Server.MapPath(@"E:UsersProfiles\skadi\Documents\Visual Studio 2012\Projects\CodeFirstDemoApplication\Fileuploads" + filename)); string path = @"E:/UsersProfiles/skadi/Documents/Visual Studio 2012/Projects/CodeFirstDemoApplication/CodeFirstDemoApplication/Images/Clothing/Men"; string folderpath = "http://*****:*****@"E:\UsersProfiles\skadi\UploadProducts\Cloths\Men\"; //string vPath = pPath.Replace(@"q:\quotewerks", "~").Replace(@"\", "/"); //int GivenDiscount = data.DiscountPercent; //float OldPrice = data.ProductCost; //string ISDiscount = data.IsDiscountAvail; //float NewPrice = 0; //GivenDiscount = Convert.ToInt32(GivenDiscount / 100); //NewPrice = Convert.ToInt32(OldPrice - (OldPrice * GivenDiscount)); data.Files.SaveAs(Path.Combine(path, fileName)); dashboard.Brand = data.Brand; dashboard.CategoryId = data.CategoryId; dashboard.Color = data.Color; dashboard.FileName = data.Files.FileName; dashboard.FilePath = folderpath; dashboard.Fit = data.Fit; dashboard.Material = data.Material; dashboard.NeckType = data.NeckType; dashboard.Occasion = data.Occasion; dashboard.ProdId = data.ProdId; dashboard.Size = data.Size; dashboard.Sleeves = data.Sleeves; dashboard.Status = data.Status; dashboard.ProductCost = data.ProductCost; dashboard.IsDiscountAvail = data.IsDiscountAvail; dashboard.DiscountPercent = data.DiscountPercent; dashboard.ProductCount = data.ProductCount; dashboard.AfterDiscountCost = data.AfterDiscountCost; dashboard.ProductDescription = data.ProductDescription; _clothCategoryBo.NewDashBoardProduct(dashboard); //DBcontext.SaveChanges(); } else { result = true; } //file.SaveAs(s); //string filepathtosave = "Images/" + filename; //file.SaveAs(filename); } //PostedPhotos.Add(FormData.Files); } catch (Exception ex) { } return Json(null, JsonRequestBehavior.AllowGet); }
//NewDashBoardProduct public void NewDashBoardProduct(DashboardCloth dashboard) { _unitOfWork.Repository<DashboardCloth>().Insert(dashboard); _unitOfWork.Save(); }
public JsonResult Testing(DashboardCloth upload) { var name = "satish"; return Json(name, JsonRequestBehavior.AllowGet); }