Ejemplo n.º 1
0
        public string DeleteArea(Area area)
        {
            string errorMessage = "Failed to delete area";
            var    childTours   = _tourRepository.GetByAreaId(area.Id);

            if (childTours.Count() == 0 && _areaRepository.DeleteEntity(area))
            {
                errorMessage = "";
            }
            else if (childTours.Count() > 0)
            {
                errorMessage = string.Format("Failed to delete area, tours associated with area must be deleted first.", childTours.Count());
            }
            return(errorMessage);
        }