public static l2g_tbl_User UserToDataEntity(UserVM userVM) { var user = new l2g_tbl_User() { UserId = userVM.UserId, Username = userVM.Username, Email = userVM.Email, Password = userVM.Password }; return(user); }
public static UserVM UserToBusinessEntity(l2g_tbl_User user) { var userVM = new UserVM() { UserId = user.UserId, Username = user.Username, Email = user.Email, Password = user.Password }; return(userVM); }
public UserVM ValidateUser(string username, string password) { l2g_tbl_User user = db.l2g_tbl_User.FirstOrDefault(u => u.Username.Equals(username, StringComparison.OrdinalIgnoreCase) && u.Password == password); if (user == null) { return(null); } return(MappingConfig.UserToBusinessEntity(user)); }
public bool RegisterUser(UserVM userVM) { l2g_tbl_User user = MappingConfig.UserToDataEntity(userVM); user.CreatedDate = DateTime.Now; try { db.l2g_tbl_User.Add(user); db.SaveChanges(); } catch (Exception) { return(false); } return(true); }