예제 #1
0
        // DELETE: api/Posts/5
        public async Task <string> Delete(int id)
        {
            var success = await PostGenericFacade.DeleteAsync(id);

            if (!success)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            return($"Deleted post with id: {id}");
        }
예제 #2
0
        public async Task <ActionResult> DeletePost(int id)
        {
            try
            {
                await PostGenericFacade.DeleteAsync(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }