public ActionResult updateDetails() { string id = Session["EmailID"].ToString(); InventoryLogin inventoryLogin = db.InventoryLogins.Find(id); return(PartialView(inventoryLogin)); }
public ActionResult DeleteConfirmed(string id) { InventoryLogin inventoryLogin = db.InventoryLogins.Find(id); db.InventoryLogins.Remove(inventoryLogin); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "EmailID,Username,Role,FirstName,LastName,PhoneNo,Department")] InventoryLogin inventoryLogin) { if (ModelState.IsValid) { db.Entry(inventoryLogin).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("List", "UserAccount")); } return(RedirectToAction("List", "UserAccount")); }
public ActionResult updateDetails([Bind(Include = "EmailID,Username,FirstName,LastName,PhoneNo,Department")] InventoryLogin inventoryLogin) { if (ModelState.IsValid) { db.Entry(inventoryLogin).State = EntityState.Modified; db.Entry(inventoryLogin).Property(x => x.Password).IsModified = false; db.Entry(inventoryLogin).Property(x => x.Role).IsModified = false; TempData["Success"] = "Details updated successfully"; db.SaveChanges(); return(RedirectToAction("Settings", "UserAccount")); } return(RedirectToAction("Settings", "UserAccount")); }
public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InventoryLogin inventoryLogin = db.InventoryLogins.Find(id); if (inventoryLogin == null) { return(HttpNotFound()); } return(View(inventoryLogin)); }
public ActionResult Create([Bind(Include = "EmailID,Username,Role,FirstName,LastName,PhoneNo,Department")] InventoryLogin inventoryLogin) { if (ModelState.IsValid) { if (!db.InventoryLogins.Any(x => x.EmailID.Equals(inventoryLogin.EmailID))) { db.InventoryLogins.Add(inventoryLogin); db.SaveChanges(); return(RedirectToAction("List")); } TempData["Error"] = "Email ID is already registered"; return(RedirectToAction("Create")); } return(View(inventoryLogin)); }
private (bool, AdminDTO) ValidateLoginUser() { var adminDto = InventoryLogin.IsValidLogin(loginUserName.Text, loginPassword.Text); if (adminDto != null) { if (!adminDto.IsActive) { MessageBox.Show("Inactive user"); } else { return(true, adminDto); } } else { MessageBox.Show("Incorrect userName or password"); } return(false, null); }
private void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtCuPsw.Text) || string.IsNullOrEmpty(txtNwPsw.Text) || string.IsNullOrEmpty(txtNwPsw2.Text)) { MessageBox.Show("Values cannot be null"); } else if (txtNwPsw.Text != txtNwPsw2.Text) { errorProvider.SetError(txtNwPsw2, "Passwords not match"); } else { int status = InventoryLogin.UpdatePassword(adminId, txtNwPsw.Text); if (status > 0) { MessageBox.Show("Successfully update"); txtCuPsw.Text = ""; txtNwPsw.Text = ""; txtNwPsw2.Text = ""; } } }
public ActionResult User(string id) { InventoryLogin inventoryLogin = db.InventoryLogins.Find(id); return(View(inventoryLogin)); }