public void TestMethod4() { //查询产品类型 ProductTypeSearchDTO dto = new ProductTypeSearchDTO(); List <ProductTypeResultDTO> list = _IProductServices.GetProductTypeList(dto); //产品类型新增 ProductTypeOperateDTO dto1 = new ProductTypeOperateDTO(); dto1.ProductTypeName = "测试产品类型Test"; dto1.ProductTypeAB = "cscplxTest"; dto1.OracleName = "ON测试产品类型Test"; dto1.CreateUser = "******"; dto1.CreateTime = DateTime.Now; bool bl = _IProductServices.AddProductType(dto1); Assert.IsTrue(bl); //查询产品类型 ProductTypeSearchDTO dto2 = new ProductTypeSearchDTO(); dto2.SearchText = "测试产品类型Test"; List <ProductTypeResultDTO> list1 = _IProductServices.GetProductTypeList(dto2); //修改产品类型 ProductTypeOperateDTO dto3 = new ProductTypeOperateDTO(); dto3.ProductTypeID = list1.Select(s => s.ProductTypeID).FirstOrDefault(); dto1.ProductTypeName = "修改测试产品类型Test"; dto1.ProductTypeAB = "cscplxTest"; dto1.OracleName = "修改ON测试产品类型Test"; dto3.ModifyUser = "******"; dto3.ModifyTime = DateTime.Now; bool bl1 = _IProductServices.UpdateProductType(dto3); Assert.IsTrue(bl1); //删除产品类型 ProductTypeSearchDTO dto5 = new ProductTypeSearchDTO(); dto5.ProductTypeID = list1.Select(s => s.ProductTypeID).FirstOrDefault(); bool bl3 = _IProductServices.DeleteProductType(dto5); Assert.IsTrue(bl3); }
public HttpResponseMessage AddProductType(ProductTypeOperateDTO dto) { ResultDTO <object> actionresult = new ResultDTO <object>(); try { actionresult.SubmitResult = _IIProductServices.AddProductType(dto); } catch (Exception e) { actionresult.SubmitResult = false; actionresult.Message = e.Message; } HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(actionresult), System.Text.Encoding.GetEncoding("UTF-8"), "application/json") }; return(result); }