public async Task <Tuple <bool, string> > CreateFeeMaster(FeeMasterModel feeMasterModel)
        {
            Tuple <bool, string> result = null;
            int insertStatus            = -1;

            try
            {
                var parameters = new DynamicParameters();
                using (SqlConnection cxn = new SqlConnection(_dcDb))
                {
                    if (feeMasterModel.FeeMasterID > 0)
                    {
                        parameters.Add("@FeeMasterID", feeMasterModel.FeeMasterID, DbType.Int32);
                    }

                    parameters.Add("@UserID", feeMasterModel.UserID, DbType.Int32);
                    parameters.Add("@CourseID", feeMasterModel.CourseID, DbType.Int32);
                    parameters.Add("@CourseFee", feeMasterModel.CourseFee, DbType.Decimal);
                    parameters.Add("@CreatedBy", UserID, DbType.Int32);
                    cxn.Open();
                    insertStatus = await cxn.ExecuteScalarAsync <int>("dbo.InsertOrUpdate_FeePerticulars", parameters, commandType : CommandType.StoredProcedure);

                    cxn.Close();
                }

                if (insertStatus == 0)
                {
                    if (feeMasterModel.FeeMasterID == 0)
                    {
                        result = Tuple.Create(true, "Fee master details created successfully");
                    }
                    else if (feeMasterModel.FeeMasterID > 0)
                    {
                        result = Tuple.Create(true, "Fee master details updated successfully");
                    }
                }
                else
                {
                    result = Tuple.Create(false, "Fee master details created failed");
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                result = Tuple.Create(false, ex.Message);
            }

            return(result);
        }
Beispiel #2
0
        public async Task <Tuple <bool, string> > CreateFeeMaster(FeeMasterModel feeMasterModel)
        {
            Tuple <bool, string> result = null;

            try
            {
                result = await _repo.CreateFeeMaster(feeMasterModel);
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }

            return(result);
        }