示例#1
0
 public ExpensePlanModel(EXPENSE_PLAN e)
 {
     expense_plan_id      = e.id;
     plan_expense_user_FK = e.plan_expense_user_FK;
     plan_expense_type_Fk = e.plan_expense_type_Fk;
     plan_expense_date    = e.plan_expense_date;
     plan_expense_size    = (decimal)e.plan_expense_size;
 }
示例#2
0
        public void UpdateExpensePlan(ExpensePlanModel epm)
        {
            var          u   = db.USER.ToList().Where(i => i.id == epm.plan_expense_user_FK).FirstOrDefault();
            EXPENSE_PLAN e_p = u.EXPENSE_PLAN.ToList().Where(i => ((DateTime)i.plan_expense_date).Date == epm.plan_expense_date.Date).FirstOrDefault();

            if (e_p == null)
            {
                CreateExpensePlan(epm);
            }
            else
            {
                e_p.plan_expense_user_FK = epm.plan_expense_user_FK;
                e_p.plan_expense_type_Fk = epm.plan_expense_type_Fk;
                e_p.plan_expense_date    = epm.plan_expense_date;
                e_p.plan_expense_size    = epm.plan_expense_size;

                Save();
            }
        }