public ActionResult SendThisForm(sponsorForm item) { item.wdate = DateTime.Now; item.udate = DateTime.Now; item.isdel = 0; sfd.Create(item); return RedirectToAction("Index"); }
//public JsonResult product(string MyChecked) //{ // product n = new product(); // productData nd = new productData(); // var array = MyChecked.Split(','); // if (MyChecked != "" && MyChecked != null) // { // for (var i = 0; i < array.Length; i++) // { // var Original = nd.Get().ToList().Where(a => a.num.ToString() == array[i]).SingleOrDefault(); // if (Original.pic1 != "") // { // var DelPath = System.IO.Path.Combine(Server.MapPath("~/upload/product/"), Original.pic1); // System.IO.File.Delete(DelPath); // } // if (Original.pic2 != "") // { // var DelPath2 = System.IO.Path.Combine(Server.MapPath("~/upload/product/"), Original.pic2); // System.IO.File.Delete(DelPath2); // } // if (Original.pic3 != "") // { // var DelPath3 = System.IO.Path.Combine(Server.MapPath("~/upload/product/"), Original.pic3); // System.IO.File.Delete(DelPath3); // } // if (Original.pic4 != "") // { // var DelPath4 = System.IO.Path.Combine(Server.MapPath("~/upload/product/"), Original.pic4); // System.IO.File.Delete(DelPath4); // } // //if (Original.jsonimg != "no_img.jpg") // //{ // // var jsonstr = JsonConvert.DeserializeObject<List<jsonSer>>(Original.jsonimg); // // var DelJsonPath = Server.MapPath("~/upload/photograhy/"); // // foreach (var j in jsonstr) // // { // // var DelJsonPathing = System.IO.Path.Combine(DelJsonPath, j.content); // // System.IO.File.Delete(DelJsonPathing); // // } // //} // n.num = Convert.ToInt32(array[i]); // n.isdel = 1; // n.udate = DateTime.Now; // nd.Delete(n); // } // } // return Json(""); //} public JsonResult sponsorForm(string MyChecked) { sponsorForm n = new sponsorForm(); sponsorFormData nd = new sponsorFormData(); var array = MyChecked.Split(','); if (MyChecked != "" && MyChecked != null) { for (var i = 0; i < array.Length; i++) { //var Original = nd.Get().ToList().Where(a => a.num.ToString() == array[i]).SingleOrDefault(); //var DelPath = System.IO.Path.Combine(Server.MapPath("~/upload//"), Original.pic1); //System.IO.File.Delete(DelPath); //if (Original.jsonimg != "no_img.jpg") //{ // var jsonstr = JsonConvert.DeserializeObject<List<jsonSer>>(Original.jsonimg); // var DelJsonPath = Server.MapPath("~/upload/photograhy/"); // foreach (var j in jsonstr) // { // var DelJsonPathing = System.IO.Path.Combine(DelJsonPath, j.content); // System.IO.File.Delete(DelJsonPathing); // } //} n.num = Convert.ToInt32(array[i]); n.isdel = 1; n.udate = DateTime.Now; nd.Delete(n); } } return Json(""); }