Example #1
0
        public async Task <ActionResult> Delete(int id)
        {
            try
            {
                var request = await requestsRepository.GetRequestAsync(id);

                if (request != null)
                {
                    await requestsRepository.RemoveRequestAsync(id);

                    await requestsRepository.SaveAsync();

                    return(Ok());
                }
                return(NotFound());
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new Response {
                    Status = "Error", Message = ex.Message
                }));
            }
        }