/// <summary> /// Get all interest rates in the Dictionary object, /// where Key = interest.Id and Value = interest.Rate /// </summary> /// <param name="maaContext"></param> public static Dictionary <long, double> GetAll(MaaContext maaContext) { //Commented code for testing purpose, when there is no DB connection //return new Dictionary<long, double> //{ // {1, 1.5 }, {2, 3.5 }, {3, 6 }, //}; IQueryable <Interest> rtn = from interest in maaContext.Interest select interest; return(rtn.ToDictionary(x => x.Id, x => x.Rate)); }
public static bool Delete(MaaContext maaContext, long id) { MortgageApprovalApplication mortgageApprovalApplication = maaContext.MortgageApprovalApplication.SingleOrDefault(application => application.Id == id); try { maaContext.MortgageApprovalApplication.Remove(mortgageApprovalApplication); maaContext.SaveChanges(); } catch (Exception exception) { //TODO: log exception return(false); } return(true); }
/// <summary> /// Get application by id /// </summary> /// <param name="maaContext">DB context</param> /// <param name="id">record id</param> /// <returns></returns> public static MortgageApprovalApplication Get(MaaContext maaContext, long id) { return(maaContext.MortgageApprovalApplication.SingleOrDefault(mortgageApprovalApplication => mortgageApprovalApplication.Id == id)); }