Ejemplo n.º 1
0
 public async Task<ActionResult> DeleteConfirmed(string id)
 {
     ApplicationUser user = UserManager.FindById(id);
     var result = await UserManager.DeleteAsync(user);
     if (!result.Succeeded)
     {
         // TODO: Adapter
         AspNetUser aspNetUser = _foodOrderingDb.AspNetUsers.Find(id);
         UserModel userModel = new UserModel
         {
             Id = aspNetUser.Id,
             Username = aspNetUser.UserName,
             Company = aspNetUser.Company == null ? "" : aspNetUser.Company.Name,
             Errors = true,
             ErrorMessage = result.Errors.First()
         };
         return View(userModel);
     }
     return RedirectToAction("List");
 }
Ejemplo n.º 2
0
 public ActionResult Delete(string id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     AspNetUser user = _foodOrderingDb.AspNetUsers.Find(id);
     if (user == null)
     {
         return HttpNotFound();
     }
     UserModel userModel = new UserModel
     {
         Id = user.Id,
         Username = user.UserName,
         Company = user.Company == null ? "" : user.Company.Name
     };
     return View(userModel);
 }