public async Task <ActionResult> CreateStoreAsync([FromBody] CreateStoreRequestModel storeModel) { var store = new Store(storeModel.Name, storeModel.StoreTypeId); _storeRepository.Add(store); await _storeRepository.UnitOfWork.SaveChangesAsync(); return(CreatedAtAction(nameof(GetByIdAsync), new { id = store.Id }, null)); }
public static Store MapAsNewEntity(this CreateStoreRequestModel model) { return(new Store { Name = model.Name, Branch = model.Branch, Address = model.Address, Employees = model.Employees }); }
public async Task <ActionResult <StoreDto> > CreateStore([FromBody] CreateStoreRequestModel requestModel) { StoreDto responseModel = await storeService.CreateStore( new CreateStoreDto { Name = requestModel.Name, Description = requestModel.Description, BrandId = requestModel.BrandId, Address = requestModel.Address, Location = new GeoEntry { Longitude = requestModel.Longitude, Latitude = requestModel.Latitude } }); if (responseModel == null) { return(InvalidRequest()); } return(CreatedAtAction(nameof(CreateStore), new { id = responseModel.Id }, responseModel)); }