// GET: Third_Partner/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }
            Third_Partner third_Partner = db.Third_Partner.Find(id);

            if (third_Partner == null)
            {
                return(HttpNotFound());
            }
            return(View(third_Partner));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Third_Partner third_Partner = db.Third_Partner.Find(id);

            db.Third_Partner.Remove(third_Partner);
            db.SaveChanges();
            FileInfo F = new FileInfo(Server.MapPath("~/Uploads/ThirdPartner/" + id + ".jpg"));

            if (F.Exists)
            {
                F.Delete();
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "ID,User_Name,Password,Name")] Third_Partner third_Partner, HttpPostedFileBase photo)
        {
            if (db.Ads_Clients.Any(x => x.Password == third_Partner.Password && x.UserName == third_Partner.User_Name) ||
                db.Agencies.Any(x => x.UserName == third_Partner.User_Name && x.Password == third_Partner.Password) ||
                db.Channels.Any(x => x.Password == third_Partner.Password && x.Username == third_Partner.User_Name) ||
                db.Third_Partner.Any(x => x.Password == third_Partner.Password && x.User_Name == third_Partner.User_Name))
            {
                ViewBag.error = "This Username And Password Is Used !";
                return(View(third_Partner));
            }
            if (ModelState.IsValid && photo != null)
            {
                db.Third_Partner.Add(third_Partner);
                db.SaveChanges();
                photo.SaveAs(Server.MapPath("~/Uploads/ThirdPartner/" + third_Partner.ID + ".jpg"));
                return(RedirectToAction("Index"));
            }

            return(View(third_Partner));
        }