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 })); }
public ActionResult Delete(long id) { if (placeService.GetPlace(id) == null) { return(NotFound()); } placeService.DeletePlace(id); return(NoContent()); }
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)); } }
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")); } }
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); }
public async Task <IActionResult> DeltePlace(int id) { await _placeService.DeletePlace(id); return(Ok()); }
public IHttpActionResult Delete(int id) { placeService.DeletePlace(id); return(Ok("")); }