Beispiel #1
0
        public async Task <IActionResult> PutBordereau([FromRoute] long id, [FromBody] Bordereau bordereau)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != bordereau.BordereauId)
            {
                return(BadRequest());
            }

            _context.Entry(bordereau).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BordereauExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutEmployee([FromRoute] string id, [FromBody] Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employee.matricule)
            {
                return(BadRequest());
            }

            _context.Entry(employee).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #3
0
        public async Task <IActionResult> PutUser([FromRoute] string id, [FromBody] User user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var U = _context.Users.Find(user.Id);

            U.FirstName = user.FirstName;
            U.LastName  = user.LastName;
            U.Email     = user.Email;
            U.Etat      = user.Etat;
            U.siteId    = user.siteId;

            _context.Entry(U).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutActivityPlace([FromRoute] long id, [FromBody] ActivityPlace activityPlace)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != activityPlace.placdeId)
            {
                return(BadRequest());
            }

            _context.Entry(activityPlace).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ActivityPlaceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #5
0
        public async Task <IActionResult> Postlist([FromBody] Rembouslist rembouslist)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            context.list.Add(rembouslist);
            await context.SaveChangesAsync();

            var dos = await context.Dossiers.FindAsync(rembouslist.Dossierreferance);

            if (dos == null)
            {
                return(NotFound());
            }
            else
            {
                dos.rembourse            = rembouslist.montant;
                dos.etat                 = "Remboursé";
                dos.rembourssementId     = rembouslist.RembouserembourssementId;
                dos.diff                 = rembouslist.montant - dos.avance;
                context.Entry(dos).State = EntityState.Modified;
                await context.SaveChangesAsync();
            }


            //rembouslist.Dossier.montant = rembouslist.montant;

            //   rembouslist.Dossier.Rembouse.rembourssementId = rembouslist.RembouserembourssementId;



            // await context.SaveChangesAsync();

            //var dossiers = .Where(d => d.referance == rembouslist.dossierID);
            //var lis = context.list.Where(l => l.rembourssementId == rembouse.rembourssementId);
            //foreach (Dossier d in dossiers)
            //{
            //  //  foreach (Rembouslist l in lis)
            //    //{
            //        if (d.referance == rembouslist.dossierID)
            //        {
            //            d.etat = "rembourser";
            //            d.rembourse = rembouslist.montant;
            //        d.rembourssementId = rembouslist.rembourssementId;
            //            context.Entry(d).State = EntityState.Modified;
            //        }
            //  //  }
            //}

            return(CreatedAtAction("Getlist", new { id = rembouslist.listId }, rembouslist));
        }
Beispiel #6
0
        public List <Dossier> GetDossierNonPayee([FromRoute] string etat)
        {
            var dossiers = _context.Dossiers.Include(d => d.employee).Include(c => c.employee.conjoints).Where(d => (d.etat == etat));
            var dos      = dossiers.ToList();

            for (int i = 0; i < dos.Count; i++)
            {
                dos[i].etat = "Envoyé à la CMIM";
                _context.Entry(dos[i]).State = EntityState.Modified;
            }
            _context.SaveChangesAsync();
            return(dos);
        }
Beispiel #7
0
        public async Task <IActionResult> PutDossier([FromRoute] string id, [FromBody] Dossier dossier)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dossier.referance)
            {
                return(BadRequest());
            }
            montantTotal = dossier.MtGi_L + dossier.MtCadre_L + dossier.MtVisite_L + dossier.MtProthese_D + dossier.MtSoins_D + dossier.Devis_D + dossier.MtVisite_M
                           + dossier.MtPharmacie_M + dossier.Mt_analyse + dossier.Mt_radio;
            if (dossier.avance < montantTotal * 0.8)
            {
                dossier.avance = dossier.avance;
            }
            else
            {
                dossier.avance = montantTotal * 0.8;
            }

            dossier.diff = montantTotal - dossier.avance;
            dossier.etat = "Ouvert";
            _context.Entry(dossier).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DossierExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }