private void SavePortfolioAction(object obj) { if (obj != null) { var x = obj as Portfolio; x.CreationDate = DateTime.Now; x.UpdationDate = DateTime.Now; x.ISActive = true; x.UserID = Session.CurrentUser.UserID; db.Portfolios.Add(x); db.SaveChanges(); } }
private void AddUserAction(object obj) { if (obj == null) { return; } else { var parameters = (object[])obj; var newUser = parameters[0] as User; dynamic paswordTemp = parameters[1]; newUser.PassWord = paswordTemp.Password; newUser.CreationDate = DateTime.Now; newUser.UpdationDate = DateTime.Now; newUser.ISActive = true; db.Users.Add(newUser); } if (CreateUser.PM) { db.User_Role.Add(new User_Role() { UserID = newUser.UserID, RoleID = 2, ISActive = true, CreationDate = DateTime.Now, UpdationDate = DateTime.Now }); } if (CreateUser.Trader) { db.User_Role.Add(new User_Role() { UserID = newUser.UserID, RoleID = 1, ISActive = true, CreationDate = DateTime.Now, UpdationDate = DateTime.Now }); } if (CreateUser.Admin) { db.User_Role.Add(new User_Role() { UserID = newUser.UserID, RoleID = 3, ISActive = true, CreationDate = DateTime.Now, UpdationDate = DateTime.Now }); } db.SaveChanges(); App.Current.MainWindow.Hide(); }