public IActionResult DeleteConfirmed(int id)
        {
            var    fileName = placeService.GetPlace(id);
            string fName    = "";

            for (int i = 1; i < fileName.Picture.Length; i++)
            {
                fName += fileName.Picture[i];
            }

            string fullPath = Path.Combine(hostingEnvironment.WebRootPath + fName);

            GC.Collect();

            if (System.IO.File.Exists(fullPath))
            {
                System.IO.File.Delete(fullPath);
                placeService.DeletePlace(id);
            }

            string searchKey = HttpContext.Session.GetString(SessionSearch);
            string selectKey = HttpContext.Session.GetString(SessionSelect);

            return(RedirectToAction("Index", "Home", new { SearchKey = searchKey, SelectKey = selectKey }));
        }
示例#2
0
 public ActionResult Delete(long id)
 {
     if (placeService.GetPlace(id) == null)
     {
         return(NotFound());
     }
     placeService.DeletePlace(id);
     return(NoContent());
 }
示例#3
0
        public async Task <IActionResult> Delete([FromRoute] int placeId)
        {
            var place = await _placeService.DeletePlace(placeId);

            if (!place)
            {
                return(NotFound());
            }

            return(Ok(place));
        }
 // [Route("Delete")]
 public ActionResult DeletePlace(int id)
 {
     try
     {
         _placeService.DeletePlace(id);
         return(StatusCode(HttpStatusCode.NoContent));
     }
     catch
     {
         return(StatusCode(HttpStatusCode.NotFound));
     }
 }
示例#5
0
        public IActionResult DeletePlace(int id)
        {
            var place = _placeService.GetPlace(id);

            if (place != null)
            {
                _placeService.DeletePlace(id);
                return(Ok());
            }
            else
            {
                return(NotFound($"Place with id {id} was not found"));
            }
        }
示例#6
0
 public IActionResult Delete([DataSourceRequest] DataSourceRequest request, PlaceViewModel place)
 {
     try
     {
         _placeService.DeletePlace(place.Id);
         return(Ok());
     }
     catch (ArgumentException ex)
     {
         return(BadRequest(ex));
     }
     catch (Exception)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }
 public void Delete(string id)
 {
     _placeService.DeletePlace(id);
 }
示例#8
0
        public async Task <IActionResult> DeltePlace(int id)
        {
            await _placeService.DeletePlace(id);

            return(Ok());
        }
示例#9
0
 public IHttpActionResult Delete(int id)
 {
     placeService.DeletePlace(id);
     return(Ok(""));
 }