예제 #1
0
        public async Task <IActionResult> DeleteAsync(int id)
        {
            var result = new ReturnData <bool>();

            result.Obj = await _service.DeleteAsync(id);

            return(Ok(result));
        }
예제 #2
0
        public async Task <IActionResult> Delete([Required] string id)
        {
            var result = await _services.DeleteAsync(id);

            if (result.IsValid)
            {
                await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Delete, Tables.Position);
            }
            return(Ok(result));
        }
예제 #3
0
        public async Task <IActionResult> Delete(Position position)
        {
            var result = await _positionService.DeleteAsync(position);

            if (result.Success)
            {
                return(Ok(result.Success));
            }
            return(BadRequest(result.Message));
        }
        public async Task <IActionResult> DeleteConfirmed(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var result = await _services.DeleteAsync(id);

            return(result.IsValid
                ? RedirectToAction("Index")
                : _oops.OutPutError("Position", "Index", result.ErrorsList));
        }
예제 #5
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var entity = _service.DeleteAsync(id);

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
예제 #6
0
        public async Task <IActionResult> DeleteConfirmed([Required] string id)
        {
            var result = await _services.DeleteAsync(id);

            if (result.IsValid)
            {
                await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Delete, Tables.Position);

                return(RedirectToAction("Index"));
            }
            TempData["ErrorsList"] = result.ErrorsList;
            return(View());
        }
예제 #7
0
        public async Task DeleteAsync(long id)
        {
            var car = dataStore.Get <Car>(id);

            if (car == null)
            {
                throw new EntityNotFoundException($"Запись типа {typeof(Car).Name} c идентификатором {id} не существует");
            }
            if (car.PositionId != null)
            {
                await positionService.DeleteAsync(car.PositionId.Value);
            }

            await dataStore.DeleteAsync(car);
        }
예제 #8
0
        /// <summary>
        /// удаление объкта по id
        /// </summary>
        /// <param name="id">код</param>
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var position = await _positionService.GetAsync(id ?? 0);

            if (position == null)
            {
                return(HttpNotFound());
            }
            await _positionService.DeleteAsync(position);

            return(RedirectToAction("Index"));
        }
예제 #9
0
        public async Task <ActionResult> DeleteAsync(int id)
        {
            try
            {
                await positionService.DeleteAsync(new PositionDTO { Id = id });

                return(NoContent());
            }
            catch (NotFoundException e)
            {
                return(NotFound(new { Id = id, e.Message }));
            }
            catch (DeleteNotPermittedException e)
            {
                return(Conflict(e.Message));
            }
        }
예제 #10
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                Position deletedDto = await _service.DeleteAsync(id, ModelState.AddModelError);

                if (deletedDto == null)
                {
                    return(BadRequest(ModelState));
                }
                return(Ok(deletedDto));
            }
            catch (EntityNotFoundException <Position, int> )
            {
                return(NotFound());
            }
        }
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _service.DeleteAsync(id);

            return(Ok(result));
        }