public async Task UpsertMonth(MonthDomain monthDomain) { var days = monthDomain.Weeks.SelectMany(x => x.Days); if (days.All(x => x.GoodOrNot == 0)) //bug where empty months overwrite data { return; } MonthData month = monthDomain.ToData(); await m_DataProvider.Upsert(month, x => x.Year == month.Year && x.Name == month.Name); }
public async Task <MonthDomain> GetMonth(string user, string name, int year) { MonthData month = await m_DataProvider.GetSingle(x => x.Name.ToLower() == name.ToLower() && x.Year == year && x.Username == user); return(month?.ToDomain()); }