示例#1
0
        public ActionResult Delete(int id)
        {
            var apiResult = TryExecute(() =>
            {
                _crmContactRepository.Delete(id);
                _unitOfWork.Commit();
                return(true);
            }, "Contact deleted sucessfully");

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public OperationResult <bool> Delete(int id)
        {
            var potentialExists = _crmPotentialRepository.Any(a => a.ContactId == id);

            if (!potentialExists)
            {
                _crmContactRepository.Delete(id);
                _unitOfWork.Commit();
                return(new OperationResult <bool> {
                    Status = true
                });
            }

            return(new OperationResult <bool> {
                Status = false, Message = "We cannot delete Contact as it has linked Potential"
            });
        }