public Check CreateCheck(m_check input, int user_id) { if (db.v_CheckLottery.Count(c => c.lot_dt == input.lot_dt && c.Country_id == input.Country_id && c.user_id == user_id && c.Id.HasValue) == 0) { var add = db.Checks.Add(new Check { Country_id = input.Country_id, lot_dt = input.lot_dt, number_lower = input.number_lower, number_upper = input.number_upper, number_three = input.number_three, Create_dt = DateTime.Now, user_id = user_id }); var res = db.SaveChanges(); if (res > 0) { return(add); } throw new Exception("failed save to database"); } throw new Exception("Have your check lottery"); }
public MoneyIncom CreateMoneyIncom(m_MoneyInCome input) { var res = db.MoneyIncoms.Add(new MoneyIncom { user_id = input.user_id, member_id = input.member_id, paid = input.paid, Create_dt = DateTime.Now }); int save = db.SaveChanges(); if (save > 0) { return(res); } return(null); }