Пример #1
0
 public async Task <HistoricalEntity> Update(HistoricalEntity historical)
 {
     var requestErrors = new string[]
     {
         Guid.TryParse(historical.Id, out var _) ? null : GlobalMessages.InvalidId(historical.Id),
         historical.Occurrence == DateTime.MinValue ? HistoricalsMessages.InvalidOccurrence(historical.Occurrence) : null,
     }.Where(e => e != null);
Пример #2
0
 public async Task <OneononeEntity> Update(OneononeEntity oneonone)
 {
     var requestErrors = new string[]
     {
         Guid.TryParse(oneonone.Id, out var _) ? null : GlobalMessages.InvalidId(oneonone.Id),
         Enum.IsDefined(typeof(FrequencyEnum), oneonone.Frequency) ? null : OneononesMessages.InvalidFrequency((int)oneonone.Frequency),
     }.Where(e => e != null);
Пример #3
0
 public async Task <(EmployeeEntity, EmployeeEntity)> ObtainPair(string leaderId, string ledId)
 {
     var requestErrors = new string[]
     {
         Guid.TryParse(leaderId, out var _) ? null : GlobalMessages.InvalidId(leaderId),
         Guid.TryParse(ledId, out var _) ? null : GlobalMessages.InvalidId(ledId),
         leaderId == ledId ? EmployeesMessages.Same : null,
     }.Where(e => e != null);
Пример #4
0
        public async Task <EmployeeEntity> Obtain(string id)
        {
            if (!Guid.TryParse(id, out var _))
            {
                throw new ApiException(HttpStatusCode.BadRequest, GlobalMessages.InvalidId(id));
            }

            var employee = await employeesRepository.Obtain(id);

            if (employee == null)
            {
                throw new ApiException(HttpStatusCode.NotFound, EmployeesMessages.NotFoundId(id));
            }

            return(employee);
        }
Пример #5
0
        public async Task <HistoricalEntity> Obtain(string id)
        {
            if (!Guid.TryParse(id, out var _))
            {
                throw new ApiException(HttpStatusCode.BadRequest, GlobalMessages.InvalidId(id));
            }

            var historical = await historicalsRepository.Obtain(id);

            if (historical == null)
            {
                throw new ApiException(HttpStatusCode.NotFound, HistoricalsMessages.NotFound(id));
            }

            await FillEmployees(historical);

            return(historical);
        }
Пример #6
0
        public async Task <OneononeEntity> Obtain(string id)
        {
            if (!Guid.TryParse(id, out var _))
            {
                throw new ApiException(HttpStatusCode.BadRequest, GlobalMessages.InvalidId(id));
            }

            var oneonone = await oneononesRepository.Obtain(id);

            if (oneonone == null)
            {
                throw new ApiException(HttpStatusCode.NotFound, OneononesMessages.NotFound(id));
            }

            await FillEmployees(oneonone);

            return(oneonone);
        }