Exemplo n.º 1
0
        public IActionResult PostRequest(Request request)
        {
            Quota quotaToAllot = quotaService.FindQuota(request);

            request = quotaService.SendPTOEmails(request, quotaToAllot);
            if (RequestExists(request.Id))
            {
                try
                {
                    uow.RequestRepo.Put(request, request.Id);
                    uow.SaveChanges();
                }
                catch (DbUpdateConcurrencyException) { throw; }
                return(Ok());
            }
            else
            {
                Request addedRequest = uow.RequestRepo.Post(request);
                uow.SaveChanges();
                return(CreatedAtAction(nameof(GetRequest), new { id = addedRequest.Id }, addedRequest));
            }
        }