Ejemplo n.º 1
0
        public IActionResult Create()
        {
            var users = this.userManager.Users.ToList();

            var model = new AdminCreatePackageViewModel
            {
                AllUsers = users.Select(u => new SelectListItem
                {
                    Text  = u.UserName,
                    Value = u.Id
                })
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(AdminCreatePackageViewModel model)
        {
            var package = await this.packages
                          .CreateAsync(
                model.Description,
                model.Weigth,
                model.ShippingAddress,
                model.RecipientId);

            TempData.AddSuccessMessage("Successfully created package.");

            var viewModel = new PackageDetailsServiceModel
            {
                Description           = package.Description,
                EstimatedDeliveryTime = package.EstimatedDeliveryDate,
                RecipientName         = package.RecipientName,
                ShippingAddress       = package.ShippingAddress,
                Status = Status.Pending,
                Weight = package.Weight
            };

            return(View(nameof(Details), viewModel));
        }