Пример #1
0
        public void ParameterService_Delete_ExistingParameterEntityPassed_IsRemovedFromCollection()
        {
            var p = _parameters.First(x => x.Id == ExistingId);

            _target.Delete(p);
            Assert.AreEqual(4, _parameters.Count());
        }
Пример #2
0
        // DELETE: api/Parameters/5
        public HttpResponseMessage DeleteParameter(int id)
        {
            var message = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request");
            var result  = iParameterService.Delete(id);

            if (result)
            {
                message = Request.CreateResponse(HttpStatusCode.OK);
            }
            return(message);
        }
Пример #3
0
        public HttpResponseMessage Delete(int id)
        {
            var entity = _parameterService.GetParameterById(id);

            if (entity == null)
            {
                return(PageHelper.toJson(PageHelper.ReturnValue(false, "删除失败!")));
            }
            if (_parameterService.Delete(entity))
            {
                return(PageHelper.toJson(PageHelper.ReturnValue(true, "删除失败!")));
            }
            return(PageHelper.toJson(PageHelper.ReturnValue(false, "删除失败!")));
        }
Пример #4
0
        public ActionResult Delete(Guid id)
        {
            try
            {
                _serviceParameter.Delete(id);
                return(Ok());
            }

            catch (InvalidTransactionException exception)
            {
                ModelState.AddModelError("ErrorMessage", exception.Message);
                return(BadRequest(ModelState));
            }

            catch (Exception)
            {
                ModelState.AddModelError("ErrorMessage", Messages.DangerRecordNotFound);
                return(BadRequest(ModelState));
            }
        }