コード例 #1
0
        public async Task <ActionResult <compagny> > PutCompagny(int id, compagny compagnyInput)
        {
            /// <summary>
            /// Edit the compagny information specified by its id
            /// </summary>
            if (id != compagnyInput.id)
            {
                return(BadRequest());
            }
            _context.Entry(compagnyInput).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CompagnyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <JoinFormationTag> > PostJoinTagForm(JoinFormationTag join)
        {
            /// <summary>
            /// Create a new Tag
            /// </summary>
            _context.joinFormationTags.Add(join);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetJoinTagForm), new { id = join.id }, join));
        }
コード例 #3
0
        public async Task <ActionResult <formation> > PostTag(tag tag)
        {
            /// <summary>
            /// Create a new Tag
            /// </summary>
            _context.tags.Add(tag);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetTag), new { id = tag.id }, tag));
        }
コード例 #4
0
 public async Task <ActionResult <applicant_session> > PutApplicantSession(int id, applicant_session applicantSessionInput)
 {
     /// <summary>
     /// Update an applicant session
     /// </summary>
     applicantSessionInput.id = id;
     if (!ApplicantSessionInputExists(id))
     {
         return(NotFound());
     }
     _context.Entry(applicantSessionInput).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
     return(StatusCode(200));
 }
コード例 #5
0
        public async Task <ActionResult <formation> > PutFormation(Guid id, formation formationPut)
        {
            /// <summary>
            /// Update the formation specific by is ID
            /// </summary>
            formationPut.id = id;
            if (!FormationExists(id))
            {
                return(NotFound());
            }
            _context.Entry(formationPut).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
            return(StatusCode(200));
        }
コード例 #6
0
        public async Task <ActionResult <orderInfo> > PostOrder(orderInfo orderBody)
        {
            var userInfo = await _userManager.FindByIdAsync(User.FindFirstValue(ClaimTypes.NameIdentifier));

            // var formationInfo = await _context.formations.FindAsync(orderBody.formationId);

            new InvoiceGenerator("./InvoiceGenerator/invoice_template.docx")
            .SetData(new
            {
                envoyeur              = "Mediwatch",
                envoyeur_addresse_1   = "24 rue Pasteur",
                envoyeur_addresse_2   = "94270 Le Kremlin-Bicêtre",
                envoyeur_addresse_3   = "France",
                destinataire          = userInfo.UserName,
                destinataire_addresse = orderBody.billingAdress,
                numéro_facture        = orderBody.invoiceId,
                date_facture          = DateTime.Now.ToString("dd/MM/yyyy"),
                description           = "Formation",
                // description = formationInfo.Name,
                quantité         = "1",
                unité            = "pce.",
                prix_unitaire_HT = orderBody.price.ToString(),
                // prix_unitaire_HT = formationInfo.Price,
                total_TTC = "-1.00",
                // total_TTC = formationInfo.Price,
                téléphone = "+33 X XX XX XX XX",
                email     = "*****@*****.**",
                IBAN      = "XXXXXXXXXX"
            })
            .SetOuput("./InvoiceGenerator/" + orderBody.invoiceId)
            .SetOverwrite(true)
            .Run();

            // EmailForm email = new EmailForm
            // {
            //     EmailAddress = userInfo.Email,
            //     Content = "Vous avez payé"
            // };

            // EmailUtils.SendMail(email, _configuration);

            new InvoiceArchiver(_configuration)
            .ArchiveInvoice("./InvoiceGenerator/" + orderBody.invoiceId, orderBody.invoiceId, userInfo.UserName);

            // orderInfo info = new orderInfo();
            orderBody.createAt = DateTime.Now;
            _context.orderInfos.Add(orderBody);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetOrder), new { id = orderBody.id }, orderBody));
        }
コード例 #7
0
        public async Task <ActionResult <applicant_session> > DeleteUserFormation(applicant_session body)
        {
            var AllApplicantSessions = await _context.applicant_sessions.ToListAsync();

            var applicantSessionsFilterById = AllApplicantSessions.Find(elem => elem.id.Equals(body.id) && elem.idUser.Equals(body.idUser));

            if (applicantSessionsFilterById == null)
            {
                return(NotFound());
            }
            _context.applicant_sessions.Remove(applicantSessionsFilterById);
            await _context.SaveChangesAsync();

            return(Ok());
        }
コード例 #8
0
        public async Task <System.Guid> CreateArticle([FromBody] Article article)
        {
            var dbArticle = new BlazingArticleModel {
                Key              = new System.Guid(),
                Title            = article.Title,
                Content          = article.Content,
                PreviewImageURL  = article.PreviewImageURL,
                PreviewParagraph = article.PreviewParagraph,
                PreviewTitle     = article.PreviewTitle,
            };

            _context.articleModels.Add(dbArticle);
            await _context.SaveChangesAsync();

            return(dbArticle.Key);
        }