public JsonResult UploadContractdoc(HttpPostedFileBase helpSectionImages, string command, string OrderID, string vid) { string fileName = string.Empty; string filename = string.Empty; //VendorImage vendorImage = new VendorImage(); //Vendormaster vendorMaster = new Vendormaster(); PartnerFile partnerFile = new PartnerFile(); if (helpSectionImages != null) { string path = System.IO.Path.GetExtension(helpSectionImages.FileName); int imageno = 0; int imagecount = 2; // var list = partnerservice.GetFiles(vid, partid); // var resellers = partnerservice.GetPartners(vid); // var reellers1 = resellers.Where(m => m.PartnerID == long.Parse(partid)).FirstOrDefault(); // if (list.Count <= imagecount && Request.Files.Count <= imagecount - list.Count) //{ //getting max imageno // if (list.Count != 0) //{ // string lastimage = list.OrderByDescending(m => m.FileName).FirstOrDefault().FileName; // var splitimage = lastimage.Split('_', '.'); // imageno = int.Parse(splitimage[3]); // } //Uploading images in db & folder for (int i = 0; i < Request.Files.Count; i++) { int j = imageno + i + 1; var file1 = Request.Files[i]; if (file1 != null && file1.ContentLength > 0) { filename = OrderID + "_" + vid + "_" + j + path; fileName = System.IO.Path.Combine(System.Web.HttpContext.Current.Server.MapPath(imagepath + filename)); file1.SaveAs(fileName); // partnerFile.FileName = filename; //vendorImage.ImageType = type;//"Slider"; //partnerFile.VendorID = vid; //partnerFile.PartnerID = partid; //partnerFile.UpdatedDate = DateTime.Now; //partnerFile.RegisteredDate = DateTime.Now; // vendorImage = vendorImageService.AddVendorImage(vendorImage, vendorMaster); // partnerFile = partnerservice.addPartnerfile(partnerFile); // } } } } return(Json(filename, JsonRequestBehavior.AllowGet)); }
public PartnerFile addPartnerfile(PartnerFile partnerFile) { partnerFile = partnerrepo.addPartnerfile(partnerFile); return(partnerFile); }
public PartnerFile addPartnerfile(PartnerFile partnerFile) { _dbContext.PartnerFile.Add(partnerFile); _dbContext.SaveChanges(); return(partnerFile); }