Esempio n. 1
0
        public HttpResponseMessage Delete(int id)
        {
            var item = _festivalService.Find(id);

            if (item != null)
            {
                try
                {
                    _festivalService.Delete(item);
                    _db.SaveChanges();

                    return(new HttpResponseMessage(HttpStatusCode.OK));
                }
                catch (Exception ex)
                {
                    String innerMessage = ex.GetInnerException();
                    return(new HttpResponseMessage(HttpStatusCode.BadRequest)
                    {
                        Content = new StringContent(ex.Message + " => " + innerMessage)
                    });
                }
            }
            return(new HttpResponseMessage(HttpStatusCode.BadRequest));
        }