Ejemplo n.º 1
0
        /// <summary>
        /// Wraps a call to EntityFramework Core Add. The call is made with a mapped entity (DataAccess.Models.Customer) instead of the domain model passed as a parameter. The DataAccess.Model is used to communicate with EF Core.
        ///
        /// EF Core Add:
        /// Finds an entity with the given primary key values. If an entity with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the database. Otherwise, a query is made to the database for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found, then null is returned.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>Domain.Models.Customer</returns>
        public void Add(Domain.Models.Customer entity)
        {
            var mappedAddress = Mapper.MapAddress(entity);

            _context.Set <Address>().Add(mappedAddress);
            _context.SaveChanges();
            _context.Entry(mappedAddress).Reload();
            var mappedEntity = Mapper.MapCustomer(entity);

            mappedEntity.Address = mappedAddress.AddressId;
            _context.Set <Customer>().Add(mappedEntity);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Wraps a call to EntityFramework Core Add. The call is made with a mapped entity (DataAccess.Models.Policies) instead of the domain model passed as a parameter. The DataAccess.Model is used to communicate with EF Core.
        ///
        /// EF Core Add:
        /// Finds an entity with the given primary key values. If an entity with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the database. Otherwise, a query is made to the database for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found, then null is returned.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>Domain.Models.Policies</returns>
        public void Add(Domain.Models.Policies entity)
        {
            var mappedEntity = Mapper.MapPolicies(entity);

            _context.Set <Policies>().Add(mappedEntity);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Wraps a call to EntityFramework Core Add. The call is made with a mapped entity (DataAccess.Models.Claims) instead of the domain model passed as a parameter. The DataAccess.Model is used to communicate with EF Core.
        ///
        /// EF Core Add:
        /// Finds an entity with the given primary key values. If an entity with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the database. Otherwise, a query is made to the database for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found, then null is returned.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>Domain.Models.Claims</returns>
        public void Add(Domain.Models.Claims entity)
        {
            var mappedEntity = Mapper.MapClaims(entity);

            _context.Set <Claims>().Add(mappedEntity);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Wraps a call to EntityFramework Core Add. The call is made with a mapped entity (DataAccess.Models.Invoice) instead of the domain model passed as a parameter. The DataAccess.Model is used to communicate with EF Core.
        ///
        /// EF Core Add:
        /// Finds an entity with the given primary key values. If an entity with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the database. Otherwise, a query is made to the database for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found, then null is returned.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>Domain.Models.Invoice</returns>
        public void Add(Domain.Models.Invoice entity)
        {
            var mappedEntity = Mapper.MapInvoice(entity);

            _context.Set <Invoice>().Add(mappedEntity);
        }
        /// <summary>
        /// Wraps a call to EntityFramework Core Add. The call is made with a mapped entity (DataAccess.Models.Employee) instead of the domain model passed as a parameter. The DataAccess.Model is used to communicate with EF Core.
        ///
        /// EF Core Add:
        /// Finds an entity with the given primary key values. If an entity with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the database. Otherwise, a query is made to the database for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found, then null is returned.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>Domain.Models.Employee</returns>
        public void Add(Domain.Models.Employee entity)
        {
            var mappedEntity = Mapper.MapEmployee(entity);

            _context.Set <Employee>().Add(mappedEntity);
        }
        /// <summary>
        /// Wraps a call to EntityFramework Core Add. The call is made with a mapped entity (DataAccess.Models.PlanProLabels) instead of the domain model passed as a parameter. The DataAccess.Model is used to communicate with EF Core.
        ///
        /// EF Core Add:
        /// Finds an entity with the given primary key values. If an entity with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the database. Otherwise, a query is made to the database for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found, then null is returned.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>Domain.Models.PlanProLabels</returns>
        public void Add(Domain.Models.PlanProLabels entity)
        {
            var mappedEntity = Mapper.MapPlanProLabels(entity);

            _context.Set <PlanProLabels>().Add(mappedEntity);
        }
        /// <summary>
        /// Wraps a call to EntityFramework Core Add. The call is made with a mapped entity (DataAccess.Models.Pet) instead of the domain model passed as a parameter. The DataAccess.Model is used to communicate with EF Core.
        ///
        /// EF Core Add:
        /// Finds an entity with the given primary key values. If an entity with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the database. Otherwise, a query is made to the database for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found, then null is returned.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>Domain.Models.Pet</returns>
        public void Add(Domain.Models.Pet entity)
        {
            var mappedEntity = Mapper.MapPet(entity);

            _context.Set <Pet>().Add(mappedEntity);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Wraps a call to EntityFramework Core Add. The call is made with a mapped entity (DataAccess.Models.Address) instead of the domain model passed as a parameter. The DataAccess.Model is used to communicate with EF Core.
        ///
        /// EF Core Add:
        /// Finds an entity with the given primary key values. If an entity with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the database. Otherwise, a query is made to the database for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found, then null is returned.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>Domain.Models.Address</returns>
        public void Add(Domain.Models.Address entity)
        {
            var mappedEntity = Mapper.MapAddress(entity);

            _context.Set <Address>().Add(mappedEntity);
        }