public ActionResult Edit(ApplyForJob job) { if (ModelState.IsValid) { db.Entry(job).State = EntityState.Modified; job.ApplyDate = DateTime.Now; db.SaveChanges(); return(RedirectToAction("GetJobByUser")); } return(View(job)); }
public int UpdateJob(JobDetail updatedjob) { var jobName = updatedjob.Job_title.ToLower(); var jobNameExcists = db.JobDetails.Where(c => c.Job_title.ToLower() != jobName); if (jobNameExcists.Where(c => c.Job_title.ToLower() == jobName).Any()) { return(-1); } db.JobDetails.Attach(updatedjob); db.Entry(updatedjob).State = System.Data.Entity.EntityState.Modified; return(db.SaveChanges()); }
public int Update(Category updatedcategory) { var CategoryName = updatedcategory.Name.ToLower(); var categorynameexcist = db.Categories.Where(c => c.Name.ToLower() != CategoryName); if (categorynameexcist.Where(c => c.Name.ToLower() == CategoryName).Any()) { return(-2); } db.Categories.Attach(updatedcategory); db.Entry(updatedcategory).State = System.Data.Entity.EntityState.Modified; return(db.SaveChanges()); }
public ActionResult Edit([Bind(Include = "Id,Message,Job_Id,User_Id,ApplyDate,File_Id,File_Content")] ApplyForJob applyForJob, HttpPostedFileBase Upload) { if (ModelState.IsValid) { string path = Path.Combine(Server.MapPath("~/FileUploads"), Upload.FileName); Upload.SaveAs(path); applyForJob.File_Id = Upload.FileName; applyForJob.User_Id = User.Identity.GetUserId(); applyForJob.ApplyDate = DateTime.Now; db.Entry(applyForJob).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Home")); } ViewBag.Job_Id = new SelectList(db.JobDetails, "Id", "Job_title", applyForJob.Job_Id); return(View(applyForJob)); }
public ActionResult Edit([Bind(Include = "Id,Job_title,Job_desc,Image_Id,User_Id,Cat_Id,Creation_Date")] JobDetail jobDetail, HttpPostedFileBase Upload) { if (ModelState.IsValid) { string path = Path.Combine(Server.MapPath("~/Uploads"), Upload.FileName); Upload.SaveAs(path); jobDetail.Image_Id = Upload.FileName; jobDetail.User_Id = User.Identity.GetUserId(); jobDetail.Creation_Date = DateTime.Now; db.Entry(jobDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Cat_Id = new SelectList(db.Categories, "Id", "Name", jobDetail.Cat_Id); return(View(jobDetail)); }