//[Test] public void DeleteRegion_WithValidId_DeleteRegion() { var regions = _placesServices.GetRegionsByCountryId(PlaceServiceTestCases.Region.CountryId); var isDeleted = _placesServices.DeleteRegion(regions.Last().RegionId); isDeleted.Should().Be(true); }
public async Task <ActionResult> DeleteRegion(string regionId) { if (regionId != null || !regionId.Equals("")) { await _placesService.DeleteRegion(regionId); } return(RedirectToAction("Index")); }
public ActionResult Delete(int id, string returnUrl) { try { var item = _placesService.GetRegionById(id); if (item == null) { AddMessageToTempData(CommonResources.NoDataFound, BusinessSolutions.MVCCommon.MessageType.Error); } else { var result = _placesService.DeleteRegion(id); if (result) { AddMessageToTempData(CommonResources.DeleteSuccessfully, BusinessSolutions.MVCCommon.MessageType.Success); } else { AddMessageToTempData(CommonResources.DeleteError, BusinessSolutions.MVCCommon.MessageType.Error); } } } catch (Exception ex) { this.Logger.Error(ex); AddMessageToView(CommonResources.SavedSuccessfullyMessage, BusinessSolutions.MVCCommon.MessageType.Error); } if (string.IsNullOrEmpty(returnUrl) && !Url.IsLocalUrl(returnUrl)) { return(RedirectToAction("Index")); } else { return(RedirectToLocal(returnUrl)); } }