public ActionResult Add(CVler cv, HttpPostedFileBase Shekil) { if (ModelState.IsValid) { if (Shekil.ContentType != "image/png" && Shekil.ContentType != "image/jpeg" && Shekil.ContentType != "image/gif") { Session["uploadError"] = "Your file must be jpg,png or gif"; return RedirectToAction("index","cv_yarat"); } if ((Shekil.ContentLength / 1024) > 1024) { Session["uploadError"] = "Your file size must be max 1mb"; return RedirectToAction("index", "cv_yarat"); } string filename = DateTime.Now.ToString("ddMMyyyyHHmmssffff") + Shekil.FileName; string path = Path.Combine(Server.MapPath("~/Uploads"), filename); Shekil.SaveAs(path); cv.Shekil = filename; cv.Cvnin_tarixi = DateTime.Now; db.CVler.Add(cv); db.SaveChanges(); return RedirectToAction("Index"); } return RedirectToAction("index", "hamisi_elan"); }
public ActionResult DeleteConfirmed(int id) { CVler cVler = db.CVler.Find(id); db.CVler.Remove(cVler); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Admin/CVler/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CVler cVler = db.CVler.Find(id); if (cVler == null) { return(HttpNotFound()); } return(View(cVler)); }
public ActionResult Create([Bind(Include = "Id,Ad,Soyad,Ata_adi,CinsId,Min_yashId,Shekil,TehsilId,Ish_tecrubesiId,VezifeId,SheherId,Min_maashId,Email,Telefon,Elave_melumat,KategoriyaId,Cvnin_tarixi,Bitme_tarixi,Status")] CVler cVler, HttpPostedFileBase Shekil) { if (ModelState.IsValid) { if (Shekil == null) { Session["uploadError"] = "Your must select your file"; return(RedirectToAction("create")); } if (Shekil.ContentType != "image/png" && Shekil.ContentType != "image/jpeg" && Shekil.ContentType != "image/gif") { Session["uploadError"] = "Your file must be jpg,png or gif"; return(RedirectToAction("create")); } if ((Shekil.ContentLength / 1024) > 1024) { Session["uploadError"] = "Your file size must be max 1mb"; return(RedirectToAction("create")); } string filename = DateTime.Now.ToString("ddMMyyyyHHmmssffff") + Shekil.FileName; string path = Path.Combine(Server.MapPath("~/Uploads"), filename); Shekil.SaveAs(path); cVler.Shekil = filename; db.CVler.Add(cVler); db.SaveChanges(); return(RedirectToAction("Index")); } //if (ModelState.IsValid) //{ // db.CVler.Add(cVler); // db.SaveChanges(); // return RedirectToAction("Index"); //} ViewBag.CinsId = new SelectList(db.Cinsler, "Id", "Cins", cVler.CinsId); ViewBag.Ish_tecrubesiId = new SelectList(db.Ish_tecrubesi, "Id", "Ili", cVler.Ish_tecrubesiId); ViewBag.KategoriyaId = new SelectList(db.Kategoriya, "Id", "Ad", cVler.KategoriyaId); ViewBag.Min_maashId = new SelectList(db.Min_maash, "Id", "Mebleg", cVler.Min_maashId); ViewBag.Min_yashId = new SelectList(db.Min_yashlar, "Id", "Min_yash", cVler.Min_yashId); ViewBag.SheherId = new SelectList(db.Sheher, "Id", "Ad", cVler.SheherId); ViewBag.TehsilId = new SelectList(db.Tehsil, "Id", "Derecesi", cVler.TehsilId); ViewBag.VezifeId = new SelectList(db.Vezife, "Id", "Ad", cVler.VezifeId); return(View(cVler)); }
// GET: Admin/CVler/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CVler cVler = db.CVler.Find(id); if (cVler == null) { return(HttpNotFound()); } ViewBag.CinsId = new SelectList(db.Cinsler, "Id", "Cins", cVler.CinsId); ViewBag.Ish_tecrubesiId = new SelectList(db.Ish_tecrubesi, "Id", "Ili", cVler.Ish_tecrubesiId); ViewBag.KategoriyaId = new SelectList(db.Kategoriya, "Id", "Ad", cVler.KategoriyaId); ViewBag.Min_maashId = new SelectList(db.Min_maash, "Id", "Mebleg", cVler.Min_maashId); ViewBag.Min_yashId = new SelectList(db.Min_yashlar, "Id", "Min_yash", cVler.Min_yashId); ViewBag.SheherId = new SelectList(db.Sheher, "Id", "Ad", cVler.SheherId); ViewBag.TehsilId = new SelectList(db.Tehsil, "Id", "Derecesi", cVler.TehsilId); ViewBag.VezifeId = new SelectList(db.Vezife, "Id", "Ad", cVler.VezifeId); return(View(cVler)); }