public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; BLL.users_service userservice = new BLL.users_service(); int id = Convert.ToInt32(context.Request.Form["hiddenId"]); Model.Users_model usermodel = new Model.Users_model(); if (usermodel != null) { usermodel.LoginPwd = context.Request.Form["txtpwd"]; usermodel.NickName = context.Request.Form["txtnick"]; usermodel.Sex = context.Request.Form["txtsex"]; usermodel.Age = Convert.ToInt32(context.Request.Form["txtage"]); usermodel.FaceId = Convert.ToInt32(context.Request.Form["txtface"]); usermodel.Friend = Convert.ToInt32(context.Request.Form["txtfriend"]); usermodel.Name = context.Request.Form["txtname"]; usermodel.StarId = Convert.ToInt32(context.Request.Form["txtstar"]); usermodel.BloodId = Convert.ToInt32(context.Request.Form["txtblood"]); usermodel.Id = id; } if (userservice.UpdateUser(usermodel)) { context.Response.Redirect("Index.ashx"); } else { context.Response.Redirect("Error.html"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; int id; if (int.TryParse(context.Request.QueryString["id"], out id)) { BLL.users_service userservice = new BLL.users_service(); Model.Users_model usermodel = userservice.GetUserById(id); string filePath = context.Request.MapPath("Updata.html"); string fileContent = File.ReadAllText(filePath); fileContent = fileContent.Replace("$pwd", usermodel.LoginPwd).Replace("$nick", usermodel.NickName) .Replace("$sex", usermodel.Sex).Replace("$age", usermodel.Age.ToString()).Replace("$face", usermodel.FaceId.ToString()) .Replace("$friend", usermodel.Friend.ToString()).Replace("$name", usermodel.Name).Replace("$star", usermodel.StarId.ToString()) .Replace("$blood", usermodel.BloodId.ToString()).Replace("$id", usermodel.Id.ToString()); context.Response.Write(fileContent); } }