public IHttpActionResult Delete(string id) { var property = _propertyService.GetById(id); CheckCurrentUserHasPermissionForObjects(CatalogPredefinedPermissions.Delete, property); _propertyService.Delete(new[] { id }); return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Delete(string id, bool doDeleteValues = false) { var property = _propertyService.GetByIds(new[] { id }); //TODO: //CheckCurrentUserHasPermissionForObjects(CatalogPredefinedPermissions.Delete, property); _propertyService.Delete(new[] { id }, doDeleteValues); return(Ok()); }
public IActionResult Delete(int id) { var succeeded = _propertyService.Delete(id); if (!succeeded) // when delete fails (false) // using tempdata because we are communicating between actions - from delete to index { TempData.Add("Error", "Sorry, the property could not be deleted, try again later."); } return(RedirectToAction(nameof(Index))); }
public ActionResult DeleteConfirmed(int id) { try { _propertyService.Delete(id); return(RedirectToAction("Index")); } catch (ArgumentException) { return(HttpNotFound()); } }
public IActionResult Delete(string id) { try { _propertyService.Delete(id); return(Ok()); } catch (System.Exception e) { _logger.LogError(e, "error: {0}", e.Message); return(BadRequest()); } }
public bool Delete(int id) { var entity = _propertyService.GetPropertyById(id); if (entity == null) { return(false); } if (_propertyService.Delete(entity)) { return(true); } return(false); }
public async Task <IActionResult> DeleteProperty(int PropertyId) { var property = await _propertyService.GetPropertyByIdAsync(PropertyId); if (property != null) { if (property.Photos.Count > 0) { for (int i = 0; i < property.Photos.Count; i++) { _photoService.Delete(property.Photos[i]); } } _propertyService.Delete(property); } return(RedirectToAction("PropertiesList")); }
public IHttpActionResult Delete(string id, bool doDeleteValues = false) { var property = _propertyService.GetById(id); CheckCurrentUserHasPermissionForObjects(CatalogPredefinedPermissions.Delete, property); if (doDeleteValues) { //TODO: Move this logic in the IPropertyService using (var repository = _repositoryFactory()) { repository.RemoveAllPropertyValues(id); repository.UnitOfWork.Commit(); } } _propertyService.Delete(new[] { id }); return(StatusCode(HttpStatusCode.NoContent)); }
private void DeletePropertyButton_Click(object sender, EventArgs e) { try { if (PropertyGridView.CurrentRow == null) { return; } var property = (PropertyModel)PropertyGridView.CurrentRow.DataBoundItem; _propertyService.Delete(property.Id); PropertyGridView.DataSource = _propertyService.GetAll(); } catch (Exception) { //log ex MessageBox.Show("System error has occurred", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async Task <IResultModel> Delete([BindRequired] Guid id) { return(await _service.Delete(id)); }
public IHttpActionResult Delete(string id) { _propertyService.Delete(new [] { id }); return(StatusCode(HttpStatusCode.NoContent)); }
void IPropertyService.Delete(string[] propertyIds) { _propertyService.Delete(propertyIds); ClearCache(); }
public ActionResult DeleteConfirmed(int id) { _propertyService.Delete(id); return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(Guid id) { await _propertyService.Delete(id); return(Ok()); }