public static changehistory GenerateHistory(this user user, int bussinesId, BussinesType bty, ChangeType cty, string note) { var history = new changehistory { UsersId = user.Id, BussinessId = bussinesId, BussinesType = bty, ChangeType = cty, CreatedDate = DateTime.Now, Note = note }; return(history); }
public static bool AddHistory(this user user, int bussinesId, BussinesType bty, ChangeType cty, string note) { var history = new changehistory { UsersId = user.Id, BussinessId = bussinesId, BussinesType = bty, ChangeType = cty, CreatedDate = DateTime.Now, Note = note }; try { using (var db = new OcphDbContext()) { return(db.Histories.Insert(history)); } } catch (Exception) { return(false); } }