예제 #1
0
        public OperationResult DeleteLocation(DeleteLocationDto deleteLocationDto)
        {
            var location = LocationRepository.GetById(deleteLocationDto.LocationId);

            if (location == null)
            {
                return(new OperationResult(false, "Şehir Bulunamadı.", (int)HttpStatusCode.NotFound));
            }
            LocationRepository.DeleteAndSave(location);
            return(new OperationResult(true, "Şehir Silindi", (int)HttpStatusCode.OK));
        }
예제 #2
0
 public ActionResult DeleteLocation(DeleteLocationDto deleteLocation)
 {
     if (!ModelState.IsValid)
     {
         var locationList = _adminServices.GetLocationsDto();
         ViewBag.locations = locationList.Select(x =>
                                                 new SelectListItem()
         {
             Text  = x.LocationName,
             Value = x.LocationId.ToString()
         });
         return(View(deleteLocation));
     }
     deleteLocation.LocationId = Convert.ToInt32(deleteLocation.LocationName);
     _adminServices.DeleteLocation(deleteLocation);
     return(Redirect("/Admin"));
 }