public ActionResult Index() { IngoTerminationViewModel model = new IngoTerminationViewModel(); model.IngoTerminationViewModelList = pro.GetIngoTerminationList(); return(View(model)); }
public bool Insert(IngoTerminationViewModel model) { using (SamajkalyanEntities ent = new SamajkalyanEntities()) { try { var Row = ent.IngoTerminations.Where(x => x.TerminationId == model.TerminationId).FirstOrDefault(); //_context.Database.Connection.Open(); //_context.Database.Connection.BeginTransaction(); if (Row == null) { Row = new IngoTermination(); } ; Row.NameOfAssest = model.NameOfAssest; Row.TerminationDate = model.TerminationDate; Row.TerminationDateNp = model.TerminationDateNp; Row.IngoId = model.IngoId; Row.EvaluationOfReportAttached = model.EvaluationOfReportAttached; //deploymentRow.Status = true; if (model.TerminationId == 0) { // generalAgreementRow.Status = false; Row.CreatedDate = model.DeletdDate; Row.CreatedBy = model.CreatedBy; ent.IngoTerminations.Add(Row); ent.SaveChanges(); } else { // deploymentRow.Status = dmodel.Status ?? false; Row.UpdateBy = model.UpdateBy; Row.UpdateDate = model.UpdateDate; ent.IngoTerminations.Attach(Row); ent.Entry(Row).State = EntityState.Modified; ent.SaveChanges(); } //if (model.TerminationId <= 0) //{ // model.GeneralAgreement_ID = ent.Database.SqlQuery<GeneralAgreementViewModel>("select * from GeneralAgreement where GeneralAgreement_ID=(select max (GeneralAgreement_ID) from GeneralAgreement )").ToList().FirstOrDefault().GeneralAgreement_ID; // //employeeRow.EmpId=employeeRow.EmpId != 0 ? employeeRow.EmpId : empModel.EmpId; //} } catch (Exception ex) { return(false); } } return(true); }
public ActionResult InsertUpdateTermination(int?id) { IngoTerminationViewModel model = new IngoTerminationViewModel(); if (id > 0) { model = pro.GetIngoTerminationById(id ?? 0); } return(View(model)); }
public ActionResult InsertUpdateTermination(IngoTerminationViewModel model) { try { var result = pro.Insert(model); if (result == true) { TempData["SuccessMsg"] = "सफल भयो"; return(RedirectToAction("Index")); } } catch { TempData["Msg"] = "असफल भयो "; return(View()); } return(View()); }
public IngoTerminationViewModel GetIngoTerminationById(int id) { SamajkalyanEntities ent = new SamajkalyanEntities(); IngoTerminationViewModel List = ent.IngoTerminations.Select(x => new IngoTerminationViewModel() { NameOfAssest = x.NameOfAssest, IngoId = x.IngoId, TerminationId = x.TerminationId, TerminationDate = x.TerminationDate, TerminationDateNp = x.TerminationDateNp, EvaluationOfReportAttached = x.EvaluationOfReportAttached, IngoName = x.GeneralAgreement.Name_Of_Ingo, DeletdDate = x.UpdateDate, DeletedBy = x.DeletedBy, }).Where(x => x.TerminationId == id).FirstOrDefault(); //}).Where(x => x.DeletedDate == null).ToList(); return(List); }