public ActionResult LoginIndex(tblUserData tUD) { if (ModelState.IsValid) { UserManager US = new UserManager(); string password = US.GetUserPassword(tUD.UserName); if (string.IsNullOrEmpty(password)) { ModelState.AddModelError("", "The user login or password provided is incorect."); } else { if (tUD.UserPassword.Equals(password)) { FormsAuthentication.SetAuthCookie(tUD.UserName, false); return(RedirectToAction("MySettingsIndex", "MyProfile")); } else { ModelState.AddModelError("", "The password provided is incorect."); } } } return(View(tUD)); }
public UserViewModel(UserView userView, tblUserData user) { recipe = new tblRecipe(); this.userView = userView; RecipesData = new RecipesData(); this.user = user; }
public IHttpActionResult PuttblUserData(int id, tblUserData tblUserData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblUserData.ID) { return(BadRequest()); } db.Entry(tblUserData).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tblUserDataExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public bool TryUpdateUserData(int userDataID, tblUserData userData) { try { using (var conn = new CompanyManagementEntities()) { var userDataToUpdate = conn.tblUserDatas.FirstOrDefault(x => x.UserDataID == userDataID); if (userDataToUpdate != null) { userDataToUpdate.Username = userData.Username; userDataToUpdate.GivenName = userData.GivenName; userDataToUpdate.MaritalStatus = userData.MaritalStatus; userDataToUpdate.PersonalNo = userData.PersonalNo; userDataToUpdate.PlaceOfResidence = userData.PlaceOfResidence; userDataToUpdate.Sex = userData.Sex; userDataToUpdate.Surname = userData.Surname; conn.SaveChanges(); return(true); } return(false); } } catch (Exception) { return(false); } }
public tblUserData TotblUserData() { tblUserData UserData = new tblUserData(); UserData.UserName = this.UserName; UserData.Email = this.Email; UserData.UserPassword = this.UserPassword; return(UserData); }
public RegistrationViewModel(RegistrationView registrationView) { this.registrationView = registrationView; Username = string.Empty; Password = string.Empty; GivenName = string.Empty; Surname = string.Empty; user = new tblUserData(); CanSave = true; }
public IHttpActionResult GettblUserData(int id) { tblUserData tblUserData = db.tblUserData.Find(id); if (tblUserData == null) { return(NotFound()); } return(Ok(tblUserData)); }
public ValidatedUserData() { GivenName = string.Empty; Surname = string.Empty; DateOfBirth = string.Empty; Email = string.Empty; Username = string.Empty; Password = string.Empty; userData = new tblUserData(); CanSave = true; }
public IHttpActionResult PosttblUserData(tblUserData tblUserData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tblUserData.Add(tblUserData); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tblUserData.ID }, tblUserData)); }
public IHttpActionResult DeletetblUserData(int id) { tblUserData tblUserData = db.tblUserData.Find(id); if (tblUserData == null) { return(NotFound()); } db.tblUserData.Remove(tblUserData); db.SaveChanges(); return(Ok(tblUserData)); }
public bool TryAddNewUserData(tblUserData userData) { try { using (var conn = new CompanyManagementEntities()) { conn.tblUserDatas.Add(userData); conn.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public AddNewAdministratorViewModel(AddNewAdministratorView addNewAdministratorView) { this.addNewAdministratorView = addNewAdministratorView; PersonalNo = string.Empty; Sex = string.Empty; PlaceOfResidence = string.Empty; MaritalStatus = string.Empty; AdministratorTeam = string.Empty; Username = string.Empty; Password = string.Empty; GivenName = string.Empty; Surname = string.Empty; Administrator = new tblAdministrator(); CanSave = true; userData = new tblUserData(); }
private void SaveExecute() { try { using (CookbookEntities context = new CookbookEntities()) { int id = recipe.RecipeID; tblRecipe newRecipe = (from x in context.tblRecipes where x.RecipeID == id select x).First(); tblUserData user = (from y in context.tblUserDatas where y.UserDataID == recipe.UserDataID select y).First(); newRecipe.Name = recipe.Name; string type = recipe.Type.ToUpper(); // type validation if ((type == "A" || type == "M" || type == "D")) { newRecipe.Type = recipe.Type; } else { MessageBox.Show("Wrong Type input, please enter A, M or D.\n(Appetizer/Main course/Dessert)"); } newRecipe.Description = recipe.Description; newRecipe.DateCreated = recipe.DateCreated; newRecipe.PersonsCount = recipe.PersonsCount; newRecipe.RecipeID = recipe.RecipeID; newRecipe.UserDataID = user.UserDataID; context.SaveChanges(); IsUpdateRecipe = true; MessageBox.Show("The recipe updated successfully."); } updateRecipe.Close(); } catch (Exception) { MessageBox.Show("Wrong inputs, please check your inputs or try again."); } }
public AddNewManagerViewModel(AddNewManagerView addNewManagerView) { this.addNewManagerView = addNewManagerView; PersonalNo = string.Empty; Sex = string.Empty; PlaceOfResidence = string.Empty; MaritalStatus = string.Empty; Username = string.Empty; Password = string.Empty; GivenName = string.Empty; Surname = string.Empty; CanSave = true; userData = new tblUserData(); Manager = new tblManager(); passwordHint = string.Empty; email = string.Empty; officeNumber = string.Empty; projectsCount = string.Empty; }
public AddNewEmployeeViewModel(AddNewEmployeeView addNewEmployeeView) { this.addNewEmployeeView = addNewEmployeeView; PersonalNo = string.Empty; Sex = string.Empty; PlaceOfResidence = string.Empty; MaritalStatus = string.Empty; Position = string.Empty; Username = string.Empty; Password = string.Empty; GivenName = string.Empty; Surname = string.Empty; CanSave = true; userData = new tblUserData(); sectors = LoadSectors(); Employee = new tblEmployee(); position = string.Empty; sector = new tblSector(); sectors = LoadSectors(); professionalQualificationsLevel = string.Empty; yearsOfService = string.Empty; sectorName = Sector.SectorName; }
public AddNewRecipe(tblUserData user) { InitializeComponent(); this.DataContext = new AddNewRecipeModel(this, user); }
public UserView(tblUserData user) { InitializeComponent(); this.DataContext = new UserViewModel(this, user); }
public AddNewRecipeModel(AddNewRecipe addRecipeOpen, tblUserData userToPass) { addRecipe = addRecipeOpen; user = userToPass; recipe = new tblRecipe(); }