1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
   | namespace Projet.Web
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using Projet.Web;
 
 
    // Implémente la logique d'application à l'aide du contexte ProjetEntities.
    // TODO: ajoutez votre logique d'application à ces méthodes ou dans d'autres méthodes.
    // TODO: connectez l'authentification (Windows/ASP.NET Forms) et supprimez les marques de commentaire suivantes pour désactiver l'accès anonyme
    // Ajoutez également des rôles pour limiter l'accès, selon le cas.
    // [RequiresAuthentication]
    /// <summary>
    /// ManagerService
    /// </summary>
    public partial class ManagerService : LinqToEntitiesDomainService<ProjetEntities>
    {
 
        // TODO:
        // appliquez une contrainte aux résultats de votre méthode query. Si vous avez besoin d'une entrée supplémentaire, vous pouvez
        // ajouter des paramètres à cette méthode ou créer d'autres méthodes query avec des noms différents.
        // Pour prendre en charge la pagination, vous devez ajouter un classement à la requête «*ADRESSE*».
        /// <summary>
        /// GetADRESSE()
        /// </summary>
        /// <returns>IQueryable ADRESSE </returns>
        public IQueryable<ADRESSE> GetADRESSE()
        {
            return this.ObjectContext.ADRESSE.Include("VILLE");
        }
 
        /// <summary>
        /// InsertADRESSE
        /// </summary>
        /// <param name="aDRESSE">ADRESSE</param>
        public void InsertADRESSE(ADRESSE aDRESSE)
        {
            if ((aDRESSE.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(aDRESSE, EntityState.Added);
            }
            else
            {
                if (this.ObjectContext.ADRESSE.FirstOrDefault(a => a.ADRESSE_NOM == aDRESSE.ADRESSE_NOM && a.ADRESSE_VILLE_ID == aDRESSE.ADRESSE_VILLE_ID) == null)
                    this.ObjectContext.ADRESSE.AddObject(aDRESSE);
            }
        }
 
        /// <summary>
        /// UpdateADRESSE
        /// </summary>
        /// <param name="currentADRESSE">ADRESSE</param>
        public void UpdateADRESSE(ADRESSE currentADRESSE)
        {
            this.ObjectContext.ADRESSE.AttachAsModified(currentADRESSE, this.ChangeSet.GetOriginal(currentADRESSE));
        }
 
        /// <summary>
        /// DeleteADRESSE
        /// </summary>
        /// <param name="aDRESSE">ADRESSE</param>
        public void DeleteADRESSE(ADRESSE aDRESSE)
        {
            if ((aDRESSE.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(aDRESSE, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.ADRESSE.Attach(aDRESSE);
                this.ObjectContext.ADRESSE.DeleteObject(aDRESSE);
            }
        }
    } | 
Partager