public async Task <StoreOpenDayDto> CreateOpenDayAsync(int branchId, StoreOpenDayDto dto) { var branchE = await Repository.GetAsync(branchId) ?? throw new EntityNotFoundException(); var openDayE = await StoreOpenDayRepository.GetAsync(e => e.StoreBranchID == branchId && e.DayOfWeek == dto.DayOfWeek); dto.StoreBranchID = branchId; var entity = ObjectMapper.Map <StoreOpenDayDto, StoreOpenDayEntity>(dto); await StoreOpenDayRepository.InsertAsync(entity, autoSave : true); return(ObjectMapper.Map <StoreOpenDayEntity, StoreOpenDayDto>(entity)); }
public async Task <StoreOpenDayDto> CreateOpenDay([FromRoute] int id, [FromBody] StoreOpenDayDto dto) { return(await StoreBranchAppService.CreateOpenDayAsync(id, dto)); }