public static PartAddInputDtoModel Map(PartAddInputModel model) { var partDto = new PartAddInputDtoModel { PartId = model.PartId, Price = model.Price, Quantity = model.Quantity, }; return(partDto); }
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")); }