public ActionResult Update(Card card) { var data = _repo.Single(card.id); data.Recto = card.recto; data.Verso = card.verso; data.IsArchived = card.isArchived; _repo.Save(data); return new EmptyResult(); }
public ActionResult Insert(Card card) { dynamic data = new ExpandoObject(); data.Recto = card.recto; data.Verso = card.verso; data.TimesCorrect = card.correctCount; data.TimesIncorrect = card.incorrectCount; data.IsArchived = card.isArchived; data.UserId = 1; _repo.Save(data); return new EmptyResult(); }
private static List<Card> GetWords(bool active) { var activeWords = new List<Card>(); var tbl = new CardRepository(); IEnumerable<dynamic> words = tbl.All(where: "WHERE IsArchived=@0", args: (active == true ? 0 : 1)); foreach (var record in words) { var card = new Card(); card.id = record.CardId; card.correctCount = record.TimesCorrect; card.incorrectCount = record.TimesIncorrect; card.isArchived = record.IsArchived == 1 ? true : false; card.recto = record.Recto; card.verso = record.Verso; activeWords.Add(card); } return activeWords; }