public ActionResult DeleteConfirmed(int id) { EmpAIConference empAIConference = db.EmpAIConferences.Find(id); db.EmpAIConferences.Remove(empAIConference); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CustomerId,ConferenceId,EmployeeCode,Name,Title,AttendedDate,CreatedDate,IsDeleted")] EmpAIConference empAIConference) { if (ModelState.IsValid) { db.Entry(empAIConference).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(empAIConference)); }
public ActionResult Create([Bind(Include = "ConferenceId,EmployeeCode,Name,Title,AttendedDate,CreatedDate,IsDeleted")] EmpAIConference empAIConference) { if (ModelState.IsValid) { db.EmpAIConferences.Add(empAIConference); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(empAIConference)); }
// GET: EmpAIConferences/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EmpAIConference empAIConference = db.EmpAIConferences.Find(id); if (empAIConference == null) { return(HttpNotFound()); } return(View(empAIConference)); }
public JsonResult Edit(EmployeeAI obj, List <EmpAIAssociation> ObjAssociation, List <EmpAIConference> ObjConferenece) { int insertedRecords = 0; try { var id = (from a in db.EmployeeAIs where a.EmployeeCode == obj.EmployeeCode select a.EmployeeAIId).FirstOrDefault(); var idgI = (from a in db.EmployeeGIs where a.EmployeeCode == obj.EmployeeCode select a.EmployeeGIId).FirstOrDefault(); EmployeeGI objempGi = db.EmployeeGIs.Find(idgI); EmployeeAI objdest = db.EmployeeAIs.Find(id); objdest.EmployeeCode = obj.EmployeeCode; objdest.InstitutionAttended1 = obj.InstitutionAttended1; objdest.InstitutionAttended2 = obj.InstitutionAttended2; objdest.InstitutionAttended3 = obj.InstitutionAttended3; objdest.Qualification1 = obj.Qualification1; objdest.Qualification2 = obj.Qualification2; objdest.Qualification3 = obj.Qualification3; objdest.YearOfGraduation1 = obj.YearOfGraduation1; objdest.YearOfGraduation2 = obj.YearOfGraduation2; objdest.YearOfGraduation3 = obj.YearOfGraduation3; objdest.CreatedDate = objdest.CreatedDate; objdest.IsDeleted = objdest.IsDeleted; objdest.ConferenceAttendedDate = DateTime.Now.Date; objdest.ConferenceAttendedName = "NA"; objdest.ConferenceAttendedTitle = "NA"; objdest.ProfessionalAssociationsDate = DateTime.Now.Date; objdest.ProfessionalAssociationsIdNo = "1"; objdest.ProfessionalAssociationsTitle = "NA"; objdest.EmployeeGI = objempGi; db.SaveChanges(); int i = (from a in db.EmployeeAIs where a.EmployeeCode == obj.EmployeeCode select a).Count(); if (i == 0) { //entities.EmployeeAIs.Add(obj); //Check for NULL. if (ObjAssociation == null) { ObjAssociation = new List <EmpAIAssociation>(); } } //Loop and insert records. foreach (EmpAIAssociation item in ObjAssociation) { EmpAIAssociation Existed_Emp = db.EmpAIAssociations.Find(item.AssociationsId); Existed_Emp.IDnumber = item.IDnumber; Existed_Emp.Title = item.Title; Existed_Emp.AttendedDate = item.AttendedDate; Existed_Emp.IsDeleted = false; } db.SaveChanges(); if (ObjConferenece == null) { ObjConferenece = new List <EmpAIConference>(); } //Loop and insert records. foreach (EmpAIConference item in ObjConferenece) { EmpAIConference Existed_Emp = db.EmpAIConferences.Find(item.ConferenceId); Existed_Emp.Name = item.Name; Existed_Emp.Title = item.Title; Existed_Emp.AttendedDate = item.AttendedDate; Existed_Emp.IsDeleted = false; } db.SaveChanges(); insertedRecords = id; } catch (Exception ext) { } return(Json(insertedRecords)); }