public ActionResult Create(SaaS__Tarif tarif, string abonnement)
        {
            List <SaaS__Abonnement> listeabo = db.SaaS__Abonnement.ToList();
            SaaS__Abonnement        abon     = listeabo.Find(s => s.Title.Equals(abonnement));
            SaaS__Tarif             tariff   = new SaaS__Tarif
            {
                ID_         = Guid.NewGuid(),
                Title       = tarif.Title,
                Description = tarif.Description,
                Tarif_Forfaitaire_Annuel = tarif.Tarif_Forfaitaire_Annuel,
                Date_Debut = DateTime.Now,
                Date_Fin   = tarif.Date_Fin,
                Tarif_Forfaitaire_Mensuel     = tarif.Tarif_Forfaitaire_Mensuel,
                Tarif_Par_Utilisateur_Annuel  = tarif.Tarif_Par_Utilisateur_Annuel,
                Tarif_Par_Utilisateur_Mensuel = tarif.Tarif_Par_Utilisateur_Mensuel,
                ID____SaaS__Abonnement        = abon.ID_
            };

            using (DbModel DbModel = new DbModel())
            {
                try
                {
                    DbModel.SaaS__Tarif.Add(tariff);
                    DbModel.SaveChanges();
                }
                catch (Exception e)
                {
                    return(View(e.Message));
                }

                return(RedirectToAction("Index"));
            }
        }
Exemple #2
0
        public ActionResult Create(SaaS__Abonnement____88____SaaS__Entreprise____88____SaaS__Tarif aboEntrTarif, string entreprise, string abonnement, string tarif)
        {
            List <SaaS__Abonnement> listeabo  = db.SaaS__Abonnement.ToList();
            SaaS__Abonnement        abon      = listeabo.Find(s => s.Title.Equals(abonnement));
            List <SaaS__Entreprise> listeent  = db.SaaS__Entreprise.ToList();
            SaaS__Entreprise        ent       = listeent.Find(s => s.Title.Equals(entreprise));
            List <SaaS__Tarif>      listtarif = db.SaaS__Tarif.ToList();
            SaaS__Tarif             t         = listtarif.Find(s => s.Title.Equals(tarif));
            SaaS__Abonnement____88____SaaS__Entreprise____88____SaaS__Tarif AET = new SaaS__Abonnement____88____SaaS__Entreprise____88____SaaS__Tarif
            {
                ID_        = Guid.NewGuid(),
                Date_Debut = aboEntrTarif.Date_Debut,
                Date_Fin   = aboEntrTarif.Date_Fin,

                ID____SaaS__Abonnement = abon.ID_,
                ID____SaaS__Entreprise = ent.ID_,
                ID____SaaS__Tarif      = t.ID_
            };

            using (DbModel DbModel = new DbModel())
            {
                try
                {
                    DbModel.SaaS__Abonnement____88____SaaS__Entreprise____88____SaaS__Tarif.Add(AET);
                    DbModel.SaveChanges();
                }
                catch (Exception e)
                {
                    return(View(e.Message));
                }

                return(RedirectToAction("Index"));
            }
        }
        public IHttpActionResult Put(Guid id, SaaS__Abonnement em)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new Models.DbModel())
            {
                var existingAbo = ctx.SaaS__Abonnement.Where(e => e.ID_ == id)
                                  .FirstOrDefault <SaaS__Abonnement>();

                if (existingAbo != null)
                {
                    existingAbo.Title       = em.Title;
                    existingAbo.Description = em.Description;
                    ctx.SaveChanges();
                }
                else
                {
                    return(NotFound());
                }
            }
            return(Ok());
        }
Exemple #4
0
        public ActionResult Create(SaaS__Abonnement____88____SaaS__Fonctionnalite Abo_Fonc, string abonnement, string fonctionnalite)
        {
            List <SaaS__Abonnement> listabos = db.SaaS__Abonnement.ToList();
            SaaS__Abonnement        abon     = listabos.Find(s => s.Title.Equals(abonnement));

            List <SaaS__Fonctionnalite> listfonct = db.SaaS__Fonctionnalite.ToList();
            SaaS__Fonctionnalite        fnct      = listfonct.Find(s => s.Title.Equals(fonctionnalite));

            SaaS__Abonnement____88____SaaS__Fonctionnalite fo = new SaaS__Abonnement____88____SaaS__Fonctionnalite
            {
                ID_ = Guid.NewGuid(),
                ID____SaaS__Abonnement     = abon.ID_,
                ID____SaaS__Fonctionnalite = fnct.ID_
            };

            using (DbModel DbModel = new DbModel())
            {
                try
                {
                    DbModel.SaaS__Abonnement____88____SaaS__Fonctionnalite.Add(fo);
                    DbModel.SaveChanges();
                }
                catch (Exception e)
                {
                    return(View(e.Message));
                }

                return(RedirectToAction("Index"));
            }
        }
 // GET: SaaS__Abonnement/Delete/5
 public ActionResult Delete(Guid id)
 {
     using (DbModel DbModel = new DbModel())
     {
         SaaS__Abonnement abo = DbModel.SaaS__Abonnement.Find(id);
         return(View(abo));
     }
 }
        public IHttpActionResult DeleteSaaS__Abonnement(Guid id)
        {
            SaaS__Abonnement saaS__Abonnement = db.SaaS__Abonnement.Find(id);

            db.SaaS__Abonnement.Remove(saaS__Abonnement);
            db.SaveChanges();

            return(Ok(saaS__Abonnement));
        }
 public ActionResult Delete(Guid id, FormCollection collection)
 {
     // TODO: Add delete logic here
     using (DbModel DbModel = new DbModel())
     {
         SaaS__Abonnement abo = DbModel.SaaS__Abonnement.Where(x => x.ID_ == id).FirstOrDefault();
         DbModel.SaaS__Abonnement.Remove(abo);
         DbModel.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
        public IHttpActionResult GetSaaS__Abonnement(Guid id)
        {
            SaaS__Abonnement saaS__Abonnement = db.SaaS__Abonnement.Find(id);
            SaaS__Abonnement abo = new SaaS__Abonnement
            {
                ID_         = saaS__Abonnement.ID_,
                Description = saaS__Abonnement.Description,
                Title       = saaS__Abonnement.Title,
            };

            return(Json(abo));
        }
        public ActionResult Edit(Guid id, SaaS__Abonnement abonnement)
        {
            try
            {
                // TODO: Add update logic here
                using (DbModel DbModel = new DbModel())
                {
                    DbModel.Entry(abonnement).State = System.Data.Entity.EntityState.Modified;
                    DbModel.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public IHttpActionResult PostSaaS__Abonnement(SaaS__Abonnement saaS__Abonnement)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

            using (var db = new Models.DbModel())
            {
                saaS__Abonnement = new SaaS__Abonnement()
                {
                    ID_         = Guid.NewGuid(),
                    Title       = saaS__Abonnement.Title,
                    Description = saaS__Abonnement.Description
                };
                db.SaaS__Abonnement.Add(saaS__Abonnement);
                db.SaveChanges();
            }

            return(CreatedAtRoute("DefaultApi", new { id = saaS__Abonnement.ID_ }, saaS__Abonnement));
            // return Ok();



            //try
            //{
            //    db.SaveChanges();
            //}
            //catch (DbUpdateException)
            //{
            //    if (SaaS__AbonnementExists(saaS__Abonnement.ID_))
            //    {
            //        return Conflict();
            //    }
            //    else
            //    {
            //        throw;
            //    }
            //}

            //return CreatedAtRoute("DefaultApi", new { id = saaS__Abonnement.ID_ }, saaS__Abonnement);
        }
        public ActionResult Create(SaaS__Abonnement abonnement)
        {
            SaaS__Abonnement abo = new SaaS__Abonnement
            {
                ID_         = Guid.NewGuid(),
                Description = abonnement.Description,
                Title       = abonnement.Title,
            };

            using (DbModel DbModel = new DbModel())
            {
                try
                {
                    DbModel.SaaS__Abonnement.Add(abo);
                    DbModel.SaveChanges();
                }
                catch (Exception e)
                {
                    return(View(e.Message));
                }

                return(RedirectToAction("Index"));
            }
        }