public OtherExpItem GetById(int id) { Mapper.CreateMap <Other_Expenses, OtherExpItem>(); Other_Expenses objOExp = DbContext.Other_Expenses.SingleOrDefault(m => m.OEID == id); OtherExpItem objOExpITem = Mapper.Map <OtherExpItem>(objOExp); return(objOExpITem); }
public int Insert(OtherExpItem model) { try { Mapper.CreateMap <OtherExpItem, Other_Expenses>(); Other_Expenses objOExp = Mapper.Map <Other_Expenses>(model); DbContext.Other_Expenses.Add(objOExp); return(DbContext.SaveChanges()); } catch (Exception ex) { throw; } }
public int Update(OtherExpItem model) { Other_Expenses TE = new Other_Expenses(); TE = DbContext.Other_Expenses.SingleOrDefault(m => m.OEID == model.OEID); TE.CompID = model.CompID; TE.EmpID = model.EmpID; TE.Date = model.Date; TE.BranchID = model.BranchID; TE.ExpID = model.ExpID; TE.Remarks = model.Remarks; TE.Amount = model.Amount; //TE.Status = model.Status; TE.UpdateBy = model.UpdateBy; TE.UpdatedDate = model.UpdatedDate; return(DbContext.SaveChanges()); }