Beispiel #1
0
        public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                var businessEntity = IncludeBusinessEntity(model.Email, model.Email, Guid.NewGuid().ToString());
                if (businessEntity.BusinessEntityId == 0)
                {
                    ErrorMessage = $"Error from include Business Entity";
                    return(RedirectToAction(nameof(Login)));
                }
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email, BusinessEntityId = businessEntity.BusinessEntityId
                };
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");
                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme);
                    await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl);

                    await _signInManager.SignInAsync(user, isPersistent : false);

                    _logger.LogInformation("User created a new account with password.");
                    businessEntity.ExternalCode = user.Id;
                    await _businessEntityServices.UpdateAsync(businessEntity);

                    return(RedirectToLocal(returnUrl));
                }
                else
                {
                    await _businessEntityServices.DeleteAsync(businessEntity);
                }
                AddErrors(result);
            }
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var client = await _ServicoCliente.GetByIdAsync(id);

            if (client == null)
            {
                return(NotFound());
            }
            try
            {
                await _ServicoCliente.DeleteAsync(client);
            }
            catch (InvalidCastException e)
            {
                return(RedirectToAction(nameof(Index)));
            }
            return(View());
        }
Beispiel #3
0
        public async Task <IActionResult> Delete(AccountBank bank)
        {
            await _bankServices.DeleteAsync(bank);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #4
0
        public async Task <IActionResult> Delete(StateProvince stateProvince)
        {
            await _stateProvinceServices.DeleteAsync(stateProvince);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #5
0
        public async Task <IActionResult> Delete(Location warehouse)
        {
            await _warehouseServices.DeleteAsync(warehouse);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #6
0
        public async Task <IActionResult> Delete(CategoryFinancial categoryFinancial)
        {
            await _categoryFinancialServices.DeleteAsync(categoryFinancial);

            return(RedirectToAction(nameof(List)));
        }
        public async Task <IActionResult> Delete(CategoryPerson CategoryPerson)
        {
            await _categoryPersonServices.DeleteAsync(CategoryPerson);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #8
0
        public async Task <IActionResult> Delete(ClassProduct classProduct)
        {
            await _classProductServices.DeleteAsync(classProduct);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #9
0
        public async Task <IActionResult> Delete(CostCenter costCenter)
        {
            await _costCenterServices.DeleteAsync(costCenter);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #10
0
        public async Task <IActionResult> Delete(City city)
        {
            await _cityServices.DeleteAsync(city);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #11
0
        public async Task <IActionResult> Delete(TaxOperation taxOperation)
        {
            await _taxOperationServices.DeleteAsync(taxOperation);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #12
0
        public async Task <IActionResult> Delete(BankTrans bankTrans)
        {
            await _bankTransServices.DeleteAsync(bankTrans);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #13
0
        public async Task <IActionResult> Delete(TaxGroup taxGroup)
        {
            await _taxGroupServices.DeleteAsync(taxGroup);

            return(RedirectToAction(nameof(List)));
        }