Esempio n. 1
0
        public IHttpActionResult Delete(string id)
        {
            var property = _propertyService.GetById(id);

            CheckCurrentUserHasPermissionForObjects(CatalogPredefinedPermissions.Delete, property);

            _propertyService.Delete(new[] { id });
            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
        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());
     }
 }
Esempio n. 5
0
        public IActionResult Delete(string id)
        {
            try
            {
                _propertyService.Delete(id);

                return(Ok());
            }
            catch (System.Exception e)
            {
                _logger.LogError(e, "error: {0}", e.Message);
                return(BadRequest());
            }
        }
Esempio n. 6
0
        public bool Delete(int id)
        {
            var entity = _propertyService.GetPropertyById(id);

            if (entity == null)
            {
                return(false);
            }
            if (_propertyService.Delete(entity))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
        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));
        }
Esempio n. 9
0
        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);
            }
        }
Esempio n. 10
0
 public async Task <IResultModel> Delete([BindRequired] Guid id)
 {
     return(await _service.Delete(id));
 }
Esempio n. 11
0
 public IHttpActionResult Delete(string id)
 {
     _propertyService.Delete(new [] { id });
     return(StatusCode(HttpStatusCode.NoContent));
 }
Esempio n. 12
0
 void IPropertyService.Delete(string[] propertyIds)
 {
     _propertyService.Delete(propertyIds);
     ClearCache();
 }
Esempio n. 13
0
 public ActionResult DeleteConfirmed(int id)
 {
     _propertyService.Delete(id);
     return(RedirectToAction("Index"));
 }
        public async Task <IActionResult> Delete(Guid id)
        {
            await _propertyService.Delete(id);

            return(Ok());
        }