public async Task ConfigureBranchSchedule(ConfigureBankScheduleViewModel request, CancellationToken cancellationToken = default)
        {
            var entity = await _context.Schedules.FindAsync(request.BranchId, request.WeekDay.ToString());

            Schedule mappedEntity;

            if (entity == null)
            {
                mappedEntity = request.Cast();
                await _context.Schedules.AddAsync(mappedEntity, cancellationToken);
            }
            else
            {
                mappedEntity = request.Map(entity);
                _context.Schedules.Update(mappedEntity);
            }

            await _context.SaveChangesAsync(cancellationToken);
        }
Example #2
0
        public async Task <ActionResult> ConfigureBranchSchedule([FromBody] ConfigureBankScheduleViewModel request)
        {
            await _branchManagement.ConfigureBranchSchedule(request);

            return(Ok());
        }