예제 #1
0
        public static List <IncomeDTO> GetList()
        {
            List <IncomeDTO> list = new List <IncomeDTO>();

            using (SuperGmachEntities db = new SuperGmachEntities())
            {
                foreach (Income i in db.Incoms)
                {
                    list.Add(IncomeConvert.DALtoDTO(i));
                }
            }
            return(list);
        }
예제 #2
0
 public static IncomeDTO GetById(int id)
 {
     SuperGmachEntities db = new SuperGmachEntities();
     {
         foreach (Income income in db.Incoms)
         {
             if ((int)income.Id == id)
             {
                 return(IncomeConvert.DALtoDTO(income));
             }
         }
         return(null);
     }
 }
예제 #3
0
        public static void Add(IncomeDTO income)
        {
            DB db = new DB();

            try
            {
                Income IncomeDAL = new Income();
                IncomeDAL = IncomeConvert.DTOtoDAL(income);
                db.Incoms.Add(IncomeDAL);
                FundBL.AddBalance((int)income.Amount);

                db.SaveChanges();
            }
            catch (Exception e)
            {
                throw new Exception(e.ToString() + ' ' + income.ToString());
            }
        }