Example #1
0
        public BaseOutput DeleteProvider(Int64 providerID, out tbl_Provider itemOut)
        {
            CRUDOperation cRUDOperation = new CRUDOperation();
            BaseOutput    baseOutput;

            itemOut = null;
            try
            {
                tbl_Provider _propvider = cRUDOperation.GetProviderById(providerID);

                if (_propvider != null)
                {
                    List <tbl_Proposal> _Proposals = cRUDOperation.GetProposalsByProviderID(_propvider.ID);

                    if (_Proposals.Count > 0)
                    {
                        return(baseOutput = new BaseOutput(false, CustomError.ProposalRecordExistErrorCode, CustomError.ProposalRecordExistErrorDesc, "Bu provayder`a bağlı xidmətlər mövcuddur!."));
                    }
                    else
                    {
                        tbl_User _user = cRUDOperation.DeleteUser(_propvider.UserId, _propvider.UserId);
                        if (_user == null)
                        {
                            return(baseOutput = new BaseOutput(false, CustomError.NotExistRecordErrorCode, CustomError.NotExistRecordErrorDesc, ""));
                        }
                        tbl_Provider _ProviderDB = cRUDOperation.DeleteProvider(_propvider.ID, _user.ID);
                        itemOut = _ProviderDB;
                        return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, ""));
                    }
                }
                return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, ""));
            }
            catch (Exception ex)
            {
                return(baseOutput = new BaseOutput(false, BOResultTypes.Danger.GetHashCode(), BOBaseOutputResponse.DangerResponse, ex.Message));
            }
        }