public int Update(EmpOtherItem model) { Mapper.CreateMap <EmpOtherItem, EmployeeOtherDetail>(); EmployeeOtherDetail objOther = DbContext.EmployeeOtherDetails.SingleOrDefault(m => m.OtherId == model.OtherId); objOther = Mapper.Map(model, objOther); return(DbContext.SaveChanges()); }
public EmpOtherItem GetById(int id) { Mapper.CreateMap <EmployeeOtherDetail, EmpOtherItem>(); EmployeeOtherDetail objOther = DbContext.EmployeeOtherDetails.SingleOrDefault(m => m.OtherId == id); EmpOtherItem objOtherItem = Mapper.Map <EmpOtherItem>(objOther); return(objOtherItem); }
public ActionResult Edit(int id, int OtId) { EmpOtherService objOtherService = new EmpOtherService(); EmpOtherItem objOtherItem = new EmpOtherItem(); objOtherItem = objOtherService.GetById(OtId); //Session["Empid"] = objOtherItem.EmpId; List <EmpOtherItem> lstOther = new List <EmpOtherItem>(); objOtherItem.ListOther = new List <EmpOtherItem>(); objOtherItem.ListOther.AddRange(lstOther); return(View(objOtherItem)); }
public ActionResult Edit(EmpOtherItem model) { int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); model.EmpId = Empid; model.UpdatedBy = Convert.ToString(Empid); model.UpdatedDate = System.DateTime.Now; EmpOtherService objOther = new EmpOtherService(); objOther.Update(model); ViewBag.Empid = Empid; return(RedirectToAction("Create", new { @id = Empid })); }
public ActionResult Create(EmpOtherItem model) { model.Status = "Active"; int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); model.EmpId = Empid; model.CreatedBy = Convert.ToString(Empid); model.CreatedDate = System.DateTime.Now; EmpOtherService objEmpOther = new EmpOtherService(); objEmpOther.Insert(model); return(RedirectToAction("Create")); }
public int Insert(EmpOtherItem model) { try { Mapper.CreateMap <EmpOtherItem, EmployeeOtherDetail>(); EmployeeOtherDetail objEmpOther = Mapper.Map <EmployeeOtherDetail>(model); DbContext.EmployeeOtherDetails.Add(objEmpOther); return(DbContext.SaveChanges()); } catch (Exception ex) { throw ex; } }
public ActionResult Create() { int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); EmpOtherService objOther = new EmpOtherService(); List <EmpOtherItem> listOther = new List <EmpOtherItem>(); listOther = objOther.OtherListData(Empid); ViewBag.Empid = Empid; EmpOtherItem objDepitem = new EmpOtherItem(); objDepitem.ListOther = new List <EmpOtherItem>(); objDepitem.ListOther.AddRange(listOther); return(View(objDepitem)); }