public ActionResult DeleteConfirmed(string id) { ProfessionalWorker professionalWorker = _db.ProfessionalWorkers.Find(id); _db.ProfessionalWorkers.Remove(professionalWorker); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(ProfessionalWorker professionalWorker) { if (ModelState.IsValid) { _db.Entry(professionalWorker).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(professionalWorker)); }
public ActionResult Create([Bind(Include = "ProfessionalWorkerId,HighestQualification,FirstName,MiddleName,LastName,Gender,Email,PhoneNumber,TownOfBirth,StateOfOrigin,Nationality,Passport")] ProfessionalWorker professionalWorker) { if (ModelState.IsValid) { _db.ProfessionalWorkers.Add(professionalWorker); _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(professionalWorker)); }
// GET: ProfessionalWorkers/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProfessionalWorker professionalWorker = _db.ProfessionalWorkers.Find(id); if (professionalWorker == null) { return(HttpNotFound()); } return(View(professionalWorker)); }
public async Task <ActionResult> RegisterProfessional(RegisterMerchantVm model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Username, Email = model.Email, FirstName = model.FirstName, LastName = model.LastName, }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { var professional = new ProfessionalWorker() { ProfessionalWorkerId = user.Id, FirstName = model.FirstName, LastName = model.LastName, Email = model.Email }; _db.ProfessionalWorkers.Add(professional); await _db.SaveChangesAsync(); //await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false); //For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); //Assign Role to user Here await this.UserManager.AddToRoleAsync(user.Id, "Professional"); return(RedirectToAction("Registration", "Account")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public async Task <ActionResult> Approve(int id) { ProfessionalWorker pWorker = await _db.ProfessionalWorkers.FindAsync(id); if (pWorker == null) { ViewBag.Message = "Please select a Merchant"; return(View()); } //_db.Merchants.Attach(merchant); pWorker.IsVerified = true; _db.Entry(pWorker).Property(x => x.IsVerified).IsModified = true; _db.SaveChanges(); ViewBag.Message = "Merchant Approval successful"; return(View()); }