Exemplo n.º 1
0
        public IActionResult AddDeclare(string id)
        {
            CustomerAddDeclarationViewModel model = new CustomerAddDeclarationViewModel();

            model.UserId = id;


            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddDeclare(CustomerAddDeclarationViewModel model)
        {
            var user = await userManager.FindByIdAsync(model.UserId);

            Declaration declaration = new Declaration();

            model.OrderNo = GenerateOrderNo(9);

            declaration.Status     = "Sifariş verildi";
            declaration.CargoPrice = CalculateCargoPrice(model.Weight);
            mapper.Map(model, declaration);

            var result = await declarationRepository.Create(declaration);

            if (result != null)
            {
                await CreateDeclarationStatus(result);

                return(RedirectToAction("Index", "Customer"));
            }


            return(View(model));
        }