public static string ManagerProductAdd(long mainSiteId, string productUrl, string productName, string productDescription, string operate) { if (mainSiteId == 0) { return(ResponseCode.NotFoundData); } if (string.IsNullOrEmpty(productUrl)) { return(ResponseCode.NotFoundData); } if (string.IsNullOrEmpty(productName)) { return(ResponseCode.NotFoundData); } if (string.IsNullOrEmpty(operate)) { return(ResponseCode.NotFoundData); } //TODO:此处需要修改 ManagerProduct managerProduct = ManagerProductFactory.Create(mainSiteId, productName, productUrl, productDescription, operate); managerProductRepository.Save(managerProduct); return(ResponseCode.Ok); }
public static void ManagerProductDelete(long id) { ManagerProduct managerProduct = managerProductRepository.GetById(id); if (managerProduct != null) { managerProductRepository.Delete(managerProduct); } }
public ActionResult ManagerProductEdit(long id) { ManagerProduct managerProduct = ManageService.GetManagerProductById(id); ViewBag.ManagerMainSite = null; if (managerProduct != null) { ManagerMainSite managerMainSite = ManageService.GetManagerMainSiteById(managerProduct.ManagerMainSiteId); ViewBag.ManagerMainSite = managerMainSite; } return(View(managerProduct)); }
public static string ManagerProductUpdate(long managerproductId, long mainSiteId, string productUrl, string productName, string productDescription, string operate) { if (managerproductId == 0) { return(ResponseCode.NotFoundData); } if (mainSiteId == 0) { return(ResponseCode.NotFoundData); } if (string.IsNullOrEmpty(productUrl)) { return(ResponseCode.NotFoundData); } if (string.IsNullOrEmpty(productName)) { return(ResponseCode.NotFoundData); } ManagerProduct managerProduct = managerProductRepository.GetById(managerproductId); if (managerProduct == null) { return(ResponseCode.NotFoundData); } if (managerProduct.ManagerMainSiteId != mainSiteId) { return(ResponseCode.NotFoundData); } managerProduct.ProductName = productName; managerProduct.ProductName = productName; managerProduct.ProductDescription = productDescription; managerProduct.Operator = operate; managerProduct.OperateTime = DateTime.Now; managerProductRepository.Save(managerProduct); return(ResponseCode.Ok); }
// GET: Api/Product public ProductController() { managerproducts = new ManagerProduct(); }