private string RunRules(SocialProgramModel socialProgram, List <SocialProgramModel> lstSocialProgram) { string validation = string.Empty; List <RulesModel> lstRules = GetRules().Result; //Max Amount Rule if (lstRules.FirstOrDefault(x => x.IdRules == 1).Active == "S") { if (int.Parse(socialProgram.value) >= int.Parse(lstRules.FirstOrDefault(x => x.IdRules == 1).Parameter)) { validation = "1,"; } } //Repeat Rule if (lstRules.FirstOrDefault(x => x.IdRules == 2).Active == "S") { var query = lstSocialProgram.GroupBy(x => x) .Where(g => g.Count() > 1) .Select(y => y.Key) .ToList().Count(); if (query > 0) { validation += "2,"; } } //CUIDO Rule if (lstRules.FirstOrDefault(x => x.IdRules == 3).Active == "S") { } //Min Date if (lstRules.FirstOrDefault(x => x.IdRules == 4).Active == "S") { if (DateTime.Parse(socialProgram.date) < DateTime.Parse(lstRules.FirstOrDefault(x => x.IdRules == 4).Parameter)) { validation += "4,"; } } //Max Date if (lstRules.FirstOrDefault(x => x.IdRules == 4).Active == "S") { if (DateTime.Parse(socialProgram.date) > DateTime.Parse(lstRules.FirstOrDefault(x => x.IdRules == 5).Parameter)) { validation += "5,"; } } return(validation); }
public async Task <bool> UpdateSocialProgram(string Id, SocialProgramModel socialProgram) { var result = await _receiveData.UpdateSocialProgramAsync(Id, socialProgram); return(result == 0 ? false : true); }