Exemple #1
0
        public async Task Update(Models.PlotPointsQuete pptQt)
        {
            try
            {
                var context  = CreateContext();
                var toUpdate = await context._PlotPointsQuete.FindAsync(pptQt.Id);

                if (toUpdate != null)
                {
                    toUpdate.Id              = pptQt.Id;
                    toUpdate.NomPlotPoint    = pptQt.NomPlotPoint;
                    toUpdate.DescrptPP       = pptQt.DescrptPP;
                    toUpdate.EstBorneTemps   = pptQt.EstBorneTemps;
                    toUpdate.DateDebut       = pptQt.DateDebut;
                    toUpdate.DateFin         = pptQt.DateFin;
                    toUpdate.EstLiéPP        = pptQt.EstLiéPP;
                    toUpdate.EstLiéQuete     = pptQt.EstLiéQuete;
                    toUpdate.EstLiéParti     = pptQt.EstLiéParti;
                    toUpdate.QueteId         = pptQt.QueteId;
                    toUpdate.ParentPPId      = pptQt.ParentPPId;
                    toUpdate.ParentPPQueteId = pptQt.ParentPPQueteId;
                    toUpdate.PartiId         = pptQt.PartiId;

                    await context.SaveChangesAsync();
                }
            }
            catch (DbUpdateException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #2
0
        public async Task <Guid> Create(Models.PlotPointsQuete pptQt)
        {
            try
            {
                var context = CreateContext();
                var created = new Data.PlotPointsQuete
                {
                    Id              = pptQt.Id,
                    NomPlotPoint    = pptQt.NomPlotPoint,
                    DescrptPP       = pptQt.DescrptPP,
                    EstBorneTemps   = pptQt.EstBorneTemps,
                    DateDebut       = pptQt.DateDebut,
                    DateFin         = pptQt.DateFin,
                    EstLiéPP        = pptQt.EstLiéPP,
                    EstLiéQuete     = pptQt.EstLiéQuete,
                    EstLiéParti     = pptQt.EstLiéParti,
                    QueteId         = pptQt.QueteId,
                    ParentPPId      = pptQt.ParentPPId,
                    ParentPPQueteId = pptQt.ParentPPQueteId,
                    PartiId         = pptQt.PartiId,
                };
                var enr = await context
                          ._PlotPointsQuete
                          .AddAsync(created);

                await context.SaveChangesAsync();

                return(enr.Entity.Id);
            }
            catch (DbUpdateException e)
            {
                Console.WriteLine(e.Message);
                return(pptQt.Id);
            }
        }
Exemple #3
0
        public async Task Delete(Models.PlotPointsQuete pptQt)
        {
            try
            {
                var context  = CreateContext();
                var toDelete = await context._PlotPointsQuete.FindAsync(pptQt.Id);

                if (toDelete != null)
                {
                    context._PlotPointsQuete.Remove(toDelete);
                    await context.SaveChangesAsync();
                }
            }
            catch (DbUpdateException e)
            {
                Console.WriteLine(e.Message);
            }
        }