コード例 #1
0
        public async Task <ActionResult> Delete(int id)
        {
            var result = await _templateService.Delete(id);

            SendBroadcast(result, "removed");

            return(Ok());
        }
コード例 #2
0
        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());
        }
コード例 #3
0
 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"
         });
     }
 }