Example #1
0
        private HOMEDTO Delete(HOMEDTO dto)
        {
            var model = _DBManger.TEST.Where(m => m.ID == dto.Model.ID);

            _DBManger.TEST.RemoveRange(model);

            return(dto);
        }
Example #2
0
        private HOMEDTO Insert(HOMEDTO dto)
        {
            if (dto.Model.ID.IsNullOrEmpty())
            {
                dto.Model.ID = _DBManger.TEST.Max(m => m.ID) + 1;
            }

            var model = dto.Model.ToNewObject(new TEST());

            _DBManger.TEST.Add(model);

            return(dto);
        }
Example #3
0
        private HOMEDTO GetAllEF(HOMEDTO dto)
        {
            string sql    = @"SELECT TOP (1000) [ID]
                              ,[DATA]
                          FROM [TCDB].[dbo].[TEST]";
            var    result = _DBMangerNoEF.ExecuteDataSet(sql, null, commandType: CommandType.Text);

            if (result.Success(dto))
            {
                dto.Models = result.OutputDataSet.Tables[0].ToList <HOMEModel>();
            }
            return(dto);
        }
Example #4
0
        private HOMEDTO DeleteEF(HOMEDTO dto)
        {
            string sql        = @"delete from [dbo].[TEST] where id = @id";
            var    parameters = CreateParameter();

            parameters.AddParameter("id", dto.Model.ID);
            var result = _DBMangerNoEF.ExecuteNonQuery(sql, parameters, CommandType.Text);

            if (!result.Success(dto))
            {
                dto.Result.IsResult  = false;
                dto.Result.ResultMsg = result.ErrorMessage;
            }

            return(dto);
        }
Example #5
0
        private HOMEDTO InsertEF(HOMEDTO dto)
        {
            string sql        = @"INSERT INTO [dbo].[TEST]
                                   ([ID]
                                   ,[DATA])
                             VALUES
                                   (@id
                                   ,@data)";
            var    parameters = CreateParameter();

            parameters.AddParameter("id", dto.Model.ID);
            parameters.AddParameter("data", dto.Model.DATA);
            var result = _DBMangerNoEF.ExecuteNonQuery(sql, parameters, CommandType.Text);

            if (!result.Success(dto))
            {
                dto.Result.IsResult  = false;
                dto.Result.ResultMsg = result.ErrorMessage;
            }

            return(dto);
        }
Example #6
0
 private HOMEDTO GetAll(HOMEDTO dto)
 {
     dto.Model = _DBManger.TEST.FirstOrDefault().ToNewObject(new HOMEModel());
     return(dto);
 }
Example #7
0
 public HOMEDA()
 {
     DTO = new HOMEDTO();
 }
Example #8
0
 private HOMEDTO Update(HOMEDTO dto)
 {
     return(dto);
 }