OL.Demo.WebForm/View/Ajax/AjaxUseAspx.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace OL.Demo.WebForm.View.Ajax
{
public partial class AjaxUseAspx : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static string GetList()
{
var listProduct = Model.ProductRepository.GetProductList();
string json = OL.Common.JsonHelper.JsonSerializer<List<Model.Product>>(listProduct);
return json;
}
[WebMethod]
public static string GetDetail(string id)
{
var product = Model.ProductRepository.GetProduct(id);
string json = OL.Common.JsonHelper.JsonSerializer<Model.Product>(product);
return json;
}
[WebMethod]
public static string Add(string id, string name, string price)
{
//string id = context.Request["id"].ToString();
//string name = context.Request["name"].ToString();
//string price = context.Request["price"].ToString();
Model.Product model = new Model.Product();
model.ID = id;
model.Name = name;
model.Price = decimal.Parse(price);
if (Model.ProductRepository.AddProduct(model))
{
return "{result:1}";
}
else
{
return "{result:-1}";
}
}
[WebMethod]
public static string Update(string id, string name, string price)
{
Model.Product model = new Model.Product();
后面还有 28 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
