Ejemplo n.º 1
0
        public async Task <ActionResult> DeleteUser(string Id, string Role)
        {
            ViewBag.MyID = CurrentUser.Id;

            var user      = UserManager.Users.FirstOrDefault(x => x.Id == Id);
            var user_info = _IUserInformationRepository.UserInformations.FirstOrDefault(x => x.id == user.user_info_id);
            var address   = _IAddressesRepository.Addresses.FirstOrDefault(x => x.id == user_info.address_id);

            await UserManager.RemoveFromRoleAsync(Id, Role);

            await UserManager.DeleteAsync(user);

            _IUserInformationRepository.DeleteUserInformation(user_info.id);
            _IAddressesRepository.DeleteAddress(address.id);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public string Delete(int id)
        {
            _repository.DeleteAddress(id);

            return("Запись удалена.");
        }