public ActionResult Edit([Bind(Include = "Id,Name,CourseCode,CourseDuration,Credit,CourseOutLine,OrganizationId")] CourseEditVM course) { if (ModelState.IsValid) { var entity = AutoMapper.Mapper.Map <Course>(course); //entity.Name = course.Name; db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); //return RedirectToAction("Index"); } //ViewBag.Name = course.Name; //ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Org_Name", course.OrganizationId); course.OrganizationLookUps = db.Organizations.Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Org_Name }).ToList(); course.TrainerLookUps = db.Trainers.Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList(); course.CourseLookUps = db.Courses.Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList(); return(View(course)); }
public ActionResult Edit([Bind(Include = "Id,Org_Name,Org_Code,Address,ContactNo,About,ImagePath")] Organization organization) { if (ModelState.IsValid) { db.Entry(organization).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(organization)); }
public ActionResult Edit([Bind(Include = "Id,ExamType,ExamCode,Topic,FullMarks,Duration,CourseId")] Exam exam) { if (ModelState.IsValid) { db.Entry(exam).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "Id", "Name", exam.CourseId); return(View(exam)); }
public ActionResult Edit([Bind(Include = "Id,Name,RegNo,ContactNo,Email,AddressLine1,AddressLine2,City,PostalCode,Country,Profession,HighestAcademic,ImagePath,BatchId")] Participant participant) { if (ModelState.IsValid) { db.Entry(participant).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BatchId = new SelectList(db.Batches, "Id", "BatchNo", participant.BatchId); return(View(participant)); }
public ActionResult Edit([Bind(Include = "Id,BatchNo,Description,StartDate,EndDate,CourseId")] Batch batch) { if (ModelState.IsValid) { db.Entry(batch).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "Id", "Name", batch.CourseId); return(View(batch)); }
public ActionResult Edit([Bind(Include = "Id,Name,ContactNo,Email,AddressLine1,AddressLine2,City,PostalCode,Country,LeadTrainer,OrganizationId,ImagePath")] Trainer trainer) { if (ModelState.IsValid) { db.Entry(trainer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Org_Name", trainer.OrganizationId); return(View(trainer)); }
public ActionResult Edit([Bind(Include = "CourseId,TrainerId")] CourseTrainer courseTrainer) { if (ModelState.IsValid) { db.Entry(courseTrainer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "Id", "Name", courseTrainer.CourseId); ViewBag.TrainerId = new SelectList(db.Trainers, "Id", "Name", courseTrainer.TrainerId); return(View(courseTrainer)); }
public ActionResult Edit([Bind(Include = "Id,Org_Name,Org_Code,Address,ContactNo,About,ImagePath")] Organization organization) { bool status = false; if (ModelState.IsValid) { db.Entry(organization).State = EntityState.Modified; db.SaveChanges(); status = true; } return(Json(status)); }
public bool Update(Organization organization) { _dbCoctext.Entry(organization).State = EntityState.Modified; return(_dbCoctext.SaveChanges() > 0); }
public bool Update(Course course) { db.Entry(course).State = EntityState.Modified; return(db.SaveChanges() > 0); }
public bool Update(T entity) { db.Entry(entity).State = EntityState.Modified; return(db.SaveChanges() > 0); }