Esempio n. 1
0
        public bool EditPropertie(IPropertieDTO propertie)
        {
            bool result = false;

            using (RealPageDBContext context = new RealPageDBContext())
            {
                using (var transation = context.Database.BeginTransaction())
                {
                    try
                    {
                        Propertie editPropertie = context.Properties.Find(propertie.IdPropertie);
                        editPropertie = propertie.MapeadorPropertie <Propertie>(editPropertie);
                        context.Properties.Update(editPropertie);
                        context.SaveChanges();
                        transation.Commit();
                        result = true;
                    }
                    catch (Exception ex)
                    {
                        transation.Rollback();
                        throw new Exception(ex.Message);
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="TR"></typeparam>
 /// <param name="origin"></param>
 /// <returns></returns>
 public static TR MapeadorPropertie <TR>(this IPropertieDTO origin) where TR : IPropertieDTO, new()
 {
     return(origin.MapeadorPropertie(new TR()));
 }