Exemple #1
0
        public static PartAddInputDtoModel Map(PartAddInputModel model)
        {
            var partDto = new PartAddInputDtoModel
            {
                PartId   = model.PartId,
                Price    = model.Price,
                Quantity = model.Quantity,
            };

            return(partDto);
        }
Exemple #2
0
        public async Task <IActionResult> Add(PartAddInputModel partAdd)
        {
            if (this.User.IsInRole(GlobalConstants.AdministratorRoleName))
            {
                if (!this.ModelState.IsValid)
                {
                    return(this.Redirect("/Part/Index"));
                }

                var partDto = PartAddInputMapper.Map(partAdd);
                await this.partService.AddQuantityAsync(partDto);

                return(this.Redirect("/Part/Index"));
            }

            return(this.Redirect("/Identity/Account/AccessDenied"));
        }