public ActionResult Save(MemberPayroll model) { try { bool Add_Flag = new PayrollBAL().isNewEntry(model.PaymentId); model.Status = "Active"; if (Add_Flag) { model.CreatOn = DateTime.Now; model.ModifidOn = DateTime.Now; new PayrollBAL().Create(model); } else { model.ModifidOn = DateTime.Now; new PayrollBAL().Update(model); } string message = CommonMsg.Success(EntityNames.Member, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update); TempData["successmsg"] = message; } catch (Exception ex) { TempData["errormsg"] = ex.Message; } return Redirect("Index"); }
public ActionResult manage(int? id) { MemberPayroll model = new MemberPayroll(); ViewBag.MemberLookUp = new MemberBAL().GetMemberLookUp(); if (id != 0 && id != null) { model = new PayrollBAL().GetById(id.Value); } return View(model); }
public void Create(MemberPayroll oMemberPayroll) { try { using (var ctx = new BHGroupEntities()) { oMemberPayroll.CreatOn = System.DateTime.Now; ctx.MemberPayrolls.Add(oMemberPayroll); ctx.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void Update(MemberPayroll oMemberPayroll) { try { using (var ctx = new BHGroupEntities()) { ctx.Entry(oMemberPayroll).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { throw ex; } }