コード例 #1
0
 public ActionResult Ajouter(Excursion.Data.Zone zone, string Centre)
 {
     Excursion.Data.Zone zn = new Data.Zone();
     zn.Nom      = zone.Nom;
     zn.CodeZone = zone.CodeZone;
     zn.CentreID = centreRepository.FindOne(x => x.Nom == Centre).CentreID;
     zoneRepository.Add(zn);
     zoneRepository.Save();
     return(RedirectToAction("Ajouter", new RouteValueDictionary(
                                 new { controller = "Excursion", action = "Ajouter" })));
 }
コード例 #2
0
        public Zone SaveZone(Zone Zone)
        {
            var storedItem = _ZoneRepositorý.GetById(Zone.Id);

            if (storedItem != null)
            {
                throw new DuplicateEntityException($"zone with Id [{Zone.Id}] already exists");
            }

            return(_ZoneRepositorý.Save(Zone));
        }
コード例 #3
0
ファイル: ServiceZone.cs プロジェクト: hassench/FiveStars
 static public void addzone(Zone zone)
 {
     using (ZoneRepository zonerepo = new ZoneRepository())
     {
         zonerepo.context.Entry(zone.PiloteZoneObli).State = EntityState.Unchanged;
         if (zone.PiloteZoneOpti != null)
         {
             zonerepo.context.Entry(zone.PiloteZoneOpti).State = EntityState.Unchanged;
         }
         zonerepo.Add(zone);
         zonerepo.Save();
     }
 }