public void InsertTravel() { try { var inserted = _travelService.Create(new Service.Model.Travel { Name = "Test" }); var travel = _travelService.Get(inserted.Id); Assert.Equals(inserted.Id, travel.Id); Assert.Equals(inserted.Name, travel.Name); _travelService.Delete(inserted.Id); Assert.Pass("InsertTravel"); } catch (Exception e) { Assert.Fail("InsertTravel"); } }
public ActionResult DeleteTravel(long travelId) { try { var travel = _travelService.GetById(travelId); if (travel != null) { _travelService.Delete(travel); } } catch (Exception e) { return(BadRequest(e.InnerException.Message)); } return(NoContent()); }