public async Task <ActionResult> Delete(string org, string app, string language) { try { TextResource existingResource = await _textRepository.Get(org, app, language); if (existingResource == null) { return(NotFound()); } bool deleted = await _textRepository.Delete(org, app, language); if (deleted) { return(Ok()); } else { _logger.LogError($"Unable to delete text resource for {org}/{app}"); return(StatusCode(500, $"Unable to delete text resource for {org}/{app}")); } } catch (Exception e) { _logger.LogError($"Unable to delete text resource for {org}/{app}: {e.Message}"); return(StatusCode(500, $"Unable to delete text resource for {org}/{app}")); } }
public void Delete(long textId) { try { _tr.Delete(textId); _rtr.Delete(textId); } catch (Exception ex) { Log.Error(ex.Message, ex); } }
/// <summary> /// Remove an entry from the collection /// </summary> /// <param name="id">The ID of the document</param> /// <returns>True if the document was successfully removed.</returns> public bool Delete(long id) => textRepository.Delete(tag, id);
public ActionResult TextTests() { try { var ctm = new CacheTestModel(); var c = CacheHelper <GHLocationTransmitModel> .Instance.GetCacheable("1"); if (c == null) { ctm.Message = "Initial Get Failed"; return(View(ctm)); } var dt = DateTime.Parse(c.DateLastModified, null, DateTimeStyles.AdjustToUniversal); var rawSound = new RawText(); rawSound.Body = ""; var s = new Text(); s.GHLocationID = 1; s.Title = "Location Controller Test"; s.UserName = UserHelper.Instance.CurrentUserName; _tr.Insert(s); rawSound.RawTextID = s.TextID; _rtr.Insert(rawSound); c = CacheHelper <GHLocationTransmitModel> .Instance.GetCacheable("1"); if (DateTime.Parse(c.DateLastModified, null, DateTimeStyles.AdjustToUniversal) == dt) { ctm.Message = "Update Date Last Modified On Sound Insert Failed"; return(View(ctm)); } dt = DateTime.Parse(c.DateLastModified, null, DateTimeStyles.AdjustToUniversal); s.Title = "Cache Update Test"; _tr.Update(s); c = CacheHelper <GHLocationTransmitModel> .Instance.GetCacheable("1"); if (DateTime.Parse(c.DateLastModified, null, DateTimeStyles.AdjustToUniversal) == dt) { ctm.Message = "Update Date Last Modified On Sound Update Failed"; return(View(ctm)); } dt = DateTime.Parse(c.DateLastModified, null, DateTimeStyles.AdjustToUniversal); _tr.Delete(s); _rtr.Delete(rawSound); c = CacheHelper <GHLocationTransmitModel> .Instance.GetCacheable("1"); if (DateTime.Parse(c.DateLastModified, null, DateTimeStyles.AdjustToUniversal) == dt) { ctm.Message = "Update Date Last Modified On Sound Delete Failed"; return(View(ctm)); } c = CacheHelper <GHLocationTransmitModel> .Instance.GetCacheable("1"); ctm.Message = "Success"; return(View(ctm)); } catch (Exception ex) { Log.Error(ex.Message, ex); return(new HttpStatusCodeResult(500)); } }