public async Task CreateAsync(ShopperViewModel shopperDTO) { var shopper = this.typeMapper.Map <Shopper>(shopperDTO); shopper.Id = shopper.Id != Guid.Empty ? shopper.Id : Guid.NewGuid(); shopper.DateCreated = DateTime.Now; shopper.SetAddress(shopper.Address); //await shopperCommand.ExecuteAsync(shopper); }
public async Task <IActionResult> Post([FromBody] ShopperViewModel shopperDTO) { try { if (this.environment.AllowPost()) { await this.shopperService.CreateAsync(shopperDTO); return(Ok()); } return(this.Unauthorized()); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }