public async Task <IActionResult> Edit(int id, [Bind("UserId,UserFName,UserLName,UserEmail")] Enduser enduser) { if (id != enduser.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(enduser); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EnduserExists(enduser.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(enduser)); }
public ActionResult VerifyOTP(string OTP, string HashCode, string OrderedItems, string username, string userPhone, string userEmail, string address, string restaurant) { ArrayList arrStatus = new ArrayList(); var rsa = new RSAHelper(RSAType.RSA2, Encoding.UTF8, privateKey, publicKey); Enduser VerifyOTP = new Enduser { OTP = rsa.Decrypt(HashCode) }; if (VerifyOTP.OTP == OTP) { // Insertion to tables and generation of order id code will go here.. var OrderId = CreateNewOrder(OrderedItems, username, userPhone, userEmail, address, 1, "", restaurant);// delivery mode is 1(COD) and paymentID is blank if (OrderId != Guid.Empty) { return(Json(OrderId)); } else { return(Json("00000000-0000-0000-0000-000000000000")); } } else { return(Json("Error")); } }
// register (User, out string) : void private void Register([Bind("UserId,UserFName,UserLName,UserEmail")] Enduser enduser, [Bind("PasswordNew")] Userpassword userpassword, out string response) { DataAccess d = new DataAccess(); d.Register(enduser, userpassword, out response); }
private bool GetValidation(int id, [Bind("UserEmail")] Enduser enduser, [Bind("PasswordNew")] Userpassword userpassword) { DataAccess d = new DataAccess(); bool v = d.Validate(enduser, userpassword); return(v); }
public ActionResult UserLogin(Enduser ULogin) { try { var model = db.UserList.Single(p => p.EUUsername == ULogin.EUUsername && p.EUPassword == ULogin.EUPassword); if (model != null) { Session["UserName"] = model.EUUsername.ToString(); if (model.EUStatus == true) { return(RedirectToAction("Index", "Enduser")); } else { ModelState.AddModelError("", "Your account has been locked, please contact admin to unlock!!!"); } } else { ModelState.AddModelError("", "The account or password is incorrect, please re-enter!!!"); } } catch (Exception e) { ModelState.AddModelError("", e.Message); } Session["Login"] = "******"; return(RedirectToAction("EUHome", "Home")); }
//------------------------------------------ //----Edit Information(End-User)------------ public ActionResult EditInforUser(string id) { Enduser model = db.UserList.SingleOrDefault(e => e.EUUsername == id); if (model == null) { Response.StatusCode = 404; return(null); } return(View(model)); }
public async Task <IActionResult> Create([Bind("UserId,UserFName,UserLName,UserEmail")] Enduser enduser) { if (ModelState.IsValid) { _context.Add(enduser); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(enduser)); }
public ActionResult EditInforUser(Enduser eUser) { try { db.Entry(eUser).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ModelState.AddModelError("", "Edit Complete!!!"); } catch (Exception e) { ModelState.AddModelError("", e.Message); } return(View()); }
public ActionResult CreateEndUser(Enduser newEndUser) { try { if (ModelState.IsValid) { db.Entry <Enduser>(newEndUser).State = System.Data.Entity.EntityState.Added; db.SaveChanges(); ModelState.AddModelError("", "Add complete!!!"); } else { ModelState.AddModelError("", "Fail"); } } catch (Exception e) { ModelState.AddModelError("", e.Message); } return(View()); }
public ActionResult VerifyOTP(string OTP, string HashCode) { ArrayList arrStatus = new ArrayList(); var rsa = new RSAHelper(RSAType.RSA2, Encoding.UTF8, privateKey, publicKey); Enduser VerifyOTP = new Enduser { OTP = rsa.Decrypt(HashCode) }; if (VerifyOTP.OTP == OTP) { // Insertion to tables and generation of order id code will go here.. OrderId = GetOrderId(); return(Json(OrderId)); } else { return(Json("Error")); } }
public ActionResult DetailsInfoUser(Enduser eUser, string id) { var model = db.UserList.SingleOrDefault(e => e.EUUsername == id); return(View(model)); }