コード例 #1
0
        public BaseOutput DeleteAppConsumeModel(Int64 id)
        {
            CRUDOperation cRUDOperation = new CRUDOperation();
            BaseOutput    baseOutput;

            try
            {
                tbl_AppConsumeModel _AppConsumeModel = cRUDOperation.GetAppConsumeModelByID(id);

                if (_AppConsumeModel != null)
                {
                    List <tbl_AppConsumeDetail> appConsumeDetails = cRUDOperation.GetAppConsumeDetailsByModelID(_AppConsumeModel.ID);

                    foreach (var item in appConsumeDetails)
                    {
                        tbl_AppConsumeDetail appConsumeDetail = cRUDOperation.DeleteAppConsumeDetail(item.ID, 0);
                    }

                    tbl_AppConsumeModel appConsumeModel = cRUDOperation.DeleteAppConsumeModel(id, 0);
                    return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, ""));
                }
                else
                {
                    return(baseOutput = new BaseOutput(false, BOResultTypes.NotFound.GetHashCode(), BOBaseOutputResponse.NotFoundResponse, ""));
                }
            }
            catch (Exception ex)
            {
                return(baseOutput = new BaseOutput(false, BOResultTypes.Danger.GetHashCode(), BOBaseOutputResponse.DangerResponse, ex.Message));
            }
        }