private ACTIONDTO Delete(ACTIONDTO dto) { var model = _DBManger.TEST.Where(m => m.ID == dto.Model.ID); _DBManger.TEST.RemoveRange(model); return(dto); }
private ACTIONDTO Update(ACTIONDTO dto) { var ID = dto.Model.ID; var model = _DBManger.TEST.First(m => m.ID == ID); model.MergeObject(dto.Model); return(dto); }
private ACTIONDTO GetAllEF(ACTIONDTO 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 <ACTIONModel>(); } return(dto); }
private ACTIONDTO Insert(ACTIONDTO 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); }
private ACTIONDTO GetAll(ACTIONDTO dto) { //dto.Model = _DBManger.TEST.FirstOrDefault().ToNewObject(new ACTIONModel()); dto.Models = _DBManger.TEST .Select(m => new { ID = m.ID, DATA = m.DATA }).Distinct().Select(m => new ACTIONModel { ID = m.ID, DATA = m.DATA }).ToList(); return(dto); }
private ACTIONDTO DeleteEF(ACTIONDTO 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); }
private ACTIONDTO GetByIDEF(ACTIONDTO dto) { string sql = @"SELECT TOP (1000) [ID] ,[DATA] FROM [TCDB].[dbo].[TEST] whrer id = @id"; var parameters = CreateParameter(); parameters.AddParameter("id", dto.Model.ID); var result = _DBMangerNoEF.ExecuteDataSet(sql, parameters, commandType: CommandType.Text); if (result.Success(dto)) { dto.Models = result.OutputDataSet.Tables[0].ToList <ACTIONModel>(); } return(dto); }
private ACTIONDTO InsertEF(ACTIONDTO 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); }
private ACTIONDTO GetByID(ACTIONDTO dto) { dto.Model = _DBManger.TEST.Where(m => m.ID == dto.Model.ID).FirstOrDefault().ToNewObject(new ACTIONModel()); return(dto); }
public ACTIONDA() { DTO = new ACTIONDTO(); }