public int EditUserDetail(UserDetailModel model) { try { using (_context = new HSSNInventoryEntities()) { var editModel = _context.UserDetails.FirstOrDefault(a => a.UserDetailId == model.UserDetailId); if (editModel != null) { editModel.Name = model.Name; editModel.Address = model.Address; editModel.Telephone = model.Telephone; editModel.EmailId = model.EmailId; editModel.UserName = model.UserName; editModel.Password = model.Password; editModel.DisplayName = model.DisplayName; editModel.OrganisationId = model.OrganisationId; editModel.CreatedBy = model.CreatedBy; editModel.CreatedDate = model.CreatedDate; editModel.ProfileId = model.ProfileId; } _context.Entry(editModel).State = EntityState.Modified; _context.SaveChanges(); return 1; } } catch (Exception e) { Console.WriteLine(e); throw; } }
private void BtnLogin_Click(object sender, EventArgs e) { UserDetailModel = null; if (_ValidForm) { //Check the nikname and the password // / LoginWork.DoLogin(tbName.Text, tbPassword.Text); var model = _userDetailService.GetUserByUser(txtUserName.Text, txtPassword.Text,Convert .ToInt32( cmbOrgaisationName.SelectedValue)); if (model != null) { if (model.Password == txtPassword.Text) { UserDetailModel = model; this.Close(); } else { MessageBox.Show("You entered wrong Organisation or username or password"); // Thread.Sleep(60000); return; this.Close(); } } } else MessageBox.Show("Please, fill all text boxes"); }
public int saveUserDetail(UserDetailModel model) { try { using (_context= new HSSNInventoryEntities() ) { var addmodel = new UserDetail() { UserDetailId = model.UserDetailId, Name = model.Name, Address = model.Address, Telephone = model.Telephone, EmailId = model.EmailId, UserName = model.UserName, Password = model.Password, DisplayName = model.DisplayName, OrganisationId = model.OrganisationId, CreatedDate = model.CreatedDate, CreatedBy = model.CreatedBy, ProfileId = model.ProfileId, }; _context.Entry(addmodel).State = EntityState.Added; _context.SaveChanges(); return addmodel.UserDetailId; } } catch (Exception e) { Console.WriteLine(e); throw; } }