public IActionResult Delete(House house)
        {
            var result = _houseService.Delete(house);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Ejemplo n.º 2
0
        public IHttpActionResult Delete(int id)
        {
            var house = _houseService.GetById(id);

            if (house == null)
            {
                return(NotFound());
            }

            _houseService.Delete(house);

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _houseService.Delete(id);

            if (result)
            {
                return(Ok("Deleted successfully"));
            }
            else
            {
                return(BadRequest("Failed to Delete"));
            }
        }
        private static void DeleteAllFlat()
        {
            var flatServiceEntities = flatService.GetAll();

            foreach (var flatServiceEntity in flatServiceEntities)
            {
                if (flatService.IsPossibilityToDelete(flatServiceEntity))
                {
                    flatService.Delete(flatServiceEntity);
                }
            }
            var houseServiceEntities = houseService.GetAll();

            foreach (var houseServiceEntity in houseServiceEntities)
            {
                if (houseService.IsPossibilityToDelete(houseServiceEntity))
                {
                    houseService.Delete(houseServiceEntity);
                }
            }
            var plotServiceEntities = plotService.GetAll();

            foreach (var plotServiceEntity in plotServiceEntities)
            {
                if (plotService.IsPossibilityToDelete(plotServiceEntity))
                {
                    plotService.Delete(plotServiceEntity);
                }
            }
            var residenceServiceEntities = residenceService.GetAll();

            foreach (var residenceServiceEntity in residenceServiceEntities)
            {
                if (residenceService.IsPossibilityToDelete(residenceServiceEntity))
                {
                    residenceService.Delete(residenceServiceEntity);
                }
            }
            var roomServiceEntities = roomService.GetAll();

            foreach (var roomServiceEntity in roomServiceEntities)
            {
                if (roomService.IsPossibilityToDelete(roomServiceEntity))
                {
                    roomService.Delete(roomServiceEntity);
                }
            }
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> DeleteHouse(Guid id)
        {
            if (id == Guid.Empty)
            {
                ViewData["houseError"] = "Failed to delete house";
                return(LocalRedirect($"/profile?houseError={ViewData["houseError"]}"));
            }
            var house = await _houseService.GetById(id);

            if (house == null)
            {
                ViewData["houseError"] = "Failed to delete house";
                return(LocalRedirect($"/profile?houseError={ViewData["houseError"]}"));
            }
            if (await _houseService.Delete(house))
            {
                return(LocalRedirect($"/profile"));
            }
            ViewData["houseError"] = "Failed to delete house";
            return(LocalRedirect($"/profile?houseError={ViewData["houseError"]}"));
        }
Ejemplo n.º 6
0
        public IActionResult Delete(int id)
        {
            var house = _houseService.GetById(id, User.Identity.GetId());

            if (house != null)
            {
                var actions = _actionService.GetByHouseId(house.Id);

                if (actions.Count == 1)
                {
                    _actionService.Delete(actions[0]);
                    _houseService.Delete(house);

                    return(View("DeleteSuccess"));
                }

                return(View("DeleteFail"));
            }

            return(NotFound());
        }
Ejemplo n.º 7
0
 public void Delete(int id)
 {
     _service.Delete(id);
 }
Ejemplo n.º 8
0
        public async Task <JsonResult> House([FromBody] DeleteRequest request)
        {
            var result = await _service.Delete(request.Id);

            return(Json(result));
        }