public async Task <ActionResult> Delete(int id) { var result = await _templateService.Delete(id); SendBroadcast(result, "removed"); return(Ok()); }
public async Task <ActionResult> DeleteTemplate(string id) { await Validate(new Entity { Id = id }); AuthorizeAny( () => Actor.IsAdmin, () => _svc.CanEdit(id, Actor.Id).Result ); var result = await _svc.Delete(id); SendBroadcast(result, "removed"); return(Ok()); }
public void RemoveTemplate(int Id) { try { TemplateService.Delete(Id); } catch (TimeoutException) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout) { Content = new StringContent("An error occurred, please try again or contact the administrator."), ReasonPhrase = "Critical Exception" }); } catch (Exception e) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent("An error occurred, please try again or contact the administrator."), ReasonPhrase = "Critical Exception" }); } }