Exemple #1
0
        /// <summary>
        /// Gets the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public Domain.MobileDeCar Get(int id)
        {
            MobileDeCar mobileDeCarDb = null;

            using (DmvEntities db = new DmvEntities())
            {
                mobileDeCarDb = db.MobileDeCar.Include("DmvCalculation").Where(c => c.IsDeleted == false && c.Id == id).FirstOrDefault();
            }

            Domain.MobileDeCar mobileDeCarEntity = Mapper.Map <Domain.MobileDeCar>(mobileDeCarDb);

            return(mobileDeCarEntity);
        }
Exemple #2
0
        /// <summary>
        /// Saves the specified mobile de car.
        /// </summary>
        /// <param name="mobileDeCar">The mobile de car.</param>
        /// <returns></returns>
        public async Task <Domain.MobileDeCar> Save(Domain.MobileDeCar mobileDeCar)
        {
            MobileDeCar mobileDeCarDb = Mapper.Map <MobileDeCar>(mobileDeCar);

            using (DmvEntities db = new DmvEntities())
            {
                mobileDeCarDb = db.MobileDeCar.Add(mobileDeCarDb);

                await db.SaveChangesAsync();
            }

            Domain.MobileDeCar mobileDeCarEntity = Mapper.Map <Domain.MobileDeCar>(mobileDeCarDb);

            return(mobileDeCarEntity);
        }