Exemple #1
0
        public async Task put(int id, DeliveryRequest request)
        {
            var model = await _repository.GetByIdAsync(id);

            model.Assignment = await _assignments.GetByIdAsync(request.AssignmentId);

            await _repository.Put(model);
        }
        public async Task <DocumentDelivery> post(DocumentDeliveryRequest request)
        {
            var upload = new UploadFiles();

            DocumentDelivery model = new DocumentDelivery();

            model.Delivery = await _delivery.GetByIdAsync(request.DeliveryId);

            model.Format  = request.Format;
            model.Name    = request.Name;
            model.Path    = upload.Upload(request.Name, request.Format, request.Doc);
            model.Student = await _student.GetByEmail(request.Student);

            var newModel = await _repository.PostAsync(model);

            return(_repository.Find(x => x.Id == newModel.Id, x => x.Delivery, x => x.Student));
        }
        public async Task <IActionResult> GetById(int id)
        {
            var delivery = await _deliveryRepository.GetByIdAsync(id);

            if (delivery == null)
            {
                return(NotFound());
            }

            return(Ok(delivery));
        }
 public async Task <Delivery> GetByIdAsync(string id)
 {
     return(await _repository.GetByIdAsync(id));
 }