Example #1
0
        public JsonResult Index(Ads a, img_st t)
        {
            bool status = false;

            db.updateemp(a);
            status = true;

            if (t.g != null)
            {
                foreach (var s in t.g)
                {
                    string inpu = s;

                    string gl = inpu.Substring(inpu.Length - 1);
                    string rl = inpu.Remove(inpu.Length - 1);

                    if (gl == "D")
                    {
                        db.Deleteimage(rl);
                        status = true;
                    }
                }
            }



            for (int i = 0; i < Request.Files.Count; i++)
            {
                var file = Request.Files[i];

                var fileName = Path.GetFileName(file.FileName);
                var path     = Path.Combine(Server.MapPath("~/Content/Images"), fileName);
                file.SaveAs(path);

                var im = "~/Content/Images/" + fileName;
                status = true;

                db.InsertImages(im, a.p_id);
                status = true;
            }

            return(new JsonResult {
                Data = new { status = status, newurl = Url.Action("Index", "MyAds") }
            });
        }