public static void Insert(object model) { //Type type = model.GetType(); //string propName = type.Name; //var property = type.GetProperty(propName); //var propertyValue = property.GetValue(model); Type type = model.GetType(); foreach (PropertyInfo prop in type.GetProperties()) { if (prop.Name == "GUID") { Int64 guid = KasifHelper.GuidFactory(); prop.SetValue(model, guid); } else if (prop.Name == "STATUS") { prop.SetValue(model, Convert.ToInt16(1)); } else if (prop.Name == "LASTUPDATED") { prop.SetValue(model, KasifHelper.GetCurrentDate()); } } DbAction(context => { context.Entry(model).State = EntityState.Added; context.SaveChanges(); }); }
private void FillSessionObject() { SessionObj = new SessionInfo(); SessionObj.Email = userObj.EMAIL; SessionObj.IsAdmin = userObj.IS_ADMIN; //SessionObj.UserId = userObj.USER_ID; SessionObj.UserGuid = userObj.GUID; SessionObj.MenuTreeItemInfo = lstMenuTreeObj; SessionObj.lstAllowedPages = lstAllowedPagesObj; SessionObj.MenuTiles = lstMenuTile; SessionObj.RoleGuid = userInfo.ROLE_GUID; SessionObj.RoleName = userInfo.ROLE_NAME; SessionObj.SessionGuid = KasifHelper.GuidFactory(); SessionObj.userNameSurname = userInfo.NAME + " " + userInfo.SURNAME; SessionObj.HocaGuid = userInfo.HOCA_GUID; SessionObj.OgrenciGuid = userInfo.OGR_GUID; }