public static object Add(string user, BirthData birthData) { string theBirthdayFormat = TheBirthdayFormat; Match match = Regex.Match(birthData.BirthdayFormat, theBirthdayFormat, RegexOptions.IgnoreCase); if (!match.Success && !birthData.TryFormatBirthday(theBirthdayFormat)) { return(new { Message = "Sorry, I can't understand the birthday you supplied." }); } if (UseFakeData) { return(FakeDataInterface.AddBirthData(user, birthData)); } string returnMessage = DatabaseInterface.AddBirthData(user, birthData); if (Regex.IsMatch(returnMessage, "success", RegexOptions.IgnoreCase)) { return(new { Message = returnMessage }); } else { return(new { Message = "There was a problem adding that birthday. Here's what we know:\n\n" + returnMessage }); } }
internal static object Update(string user, BirthData birthData) { if (birthData == null) { return(new { Message = "I'm sorry, the server could not find the birth data in the object you passed in." }); } string theBirthdayFormat = TheBirthdayFormat; string formatIn = birthData.BirthdayFormat; if (formatIn == null) { formatIn = string.Empty; } Match match = Regex.Match(formatIn, theBirthdayFormat, RegexOptions.IgnoreCase); if (!match.Success && !birthData.TryFormatBirthday(theBirthdayFormat)) { return(new { Message = "Sorry, I can't understand the birthday you supplied." }); } if (UseFakeData) { return(FakeDataInterface.UpdateBirthData(user, birthData)); } string returnMessage = DatabaseInterface.UpdateBirthData(user, birthData); if (Regex.IsMatch(returnMessage, "success", RegexOptions.IgnoreCase)) { return(new { Message = returnMessage }); } else { return(new { Message = "There was a problem adding that birthday. Here's what we know:\n\n" + returnMessage }); } }
internal static object UpdateBirthData(string user, Models.BirthData birthData) { throw new NotImplementedException(); }
internal static bool AddBirthData(string user, Models.BirthData birthData) { throw new NotImplementedException(); }