public IActionResult Create([Bind("Name,Address,BirthDay,Id")] Vendor vendor, string gender, string identificationType, string identificationNumber) { if (ModelState.IsValid) { vendor.Identification = Identification.NewIdentification(identificationType, identificationNumber); vendor.Gender = Gender.NewGender(gender); vendor.Id = Guid.NewGuid(); _vendorService.Create(vendor); _vendorService.Complete(); return(RedirectToAction(nameof(Index))); } ViewBag.Genders = new SelectList(Gender.ListAll(), "Description", "Description"); ViewBag.IdentificationTypes = new SelectList(Identification.ListTypes()); return(View(vendor)); }
public void Handle(CreateVendorCommand command) { _vendorService.Create(command.Vendor); _vendorService.Complete(); }