public NotasCache RemoveFromCache(NotasCache cached, SinglePropJson json) { if (cached.anchored.Any(nota => nota.NotaId == int.Parse(json.Value))) { cached.anchored.Remove(cached.anchored.Where(nota => nota.NotaId == int.Parse(json.Value)).First()); } else { cached.notAnchored.Remove(cached.notAnchored.Where(nota => nota.NotaId == int.Parse(json.Value)).First()); } return(cached); }
public ActionResult Delete(SinglePropJson json) { PersistedState ps = _notasService.Remove(int.Parse(json.Value)); if (ps == PersistedState.OK) { NotasCache cached = GetSessionItem <NotasCache>(Resources.MisNotas); RemoveFromSession(Resources.MisNotas); SetSessionItem(Resources.MisNotas, _notasService.RemoveFromCache(cached, json)); } return(SimpleJSONFeedback(ps)); }