protected void btnSubmit_Click(object sender, EventArgs e) { Model.Video u = new Model.Video { Video_Title = this.txtTitle.Text.Trim(), Video_Intro = this.txtContent.Text, Video_Path = this.textIntro.Text.Trim(), Video_Image = upFileName(this.FileUpload1, "../../upload/Video/"), }; var res = VideoSvc.Add(u); ReturnMsg rm = res > 0 ? new ReturnMsg() { Code = StatusCode.OK, Message = "新增用户信息成功", Data = null } : new ReturnMsg() { Code = StatusCode.Error, Message = "新增用户信息失败", Data = null }; Session["Msg"] = rm; //用于传递执行信息的 Response.Redirect("Video_List.aspx"); }
protected void btnSubmit_Click(object sender, EventArgs e) { string photo = upFileName(this.FileUpload1, "../../upload/users/"); Model.Video p = VideoSvc.GetVideoById(Guid.Parse(this.hfId.Value)); if (photo == "") { p = new Model.Video { Video_Title = this.txtName.Text, Video_Intro = this.txtIntro.Text, Video_Path = this.textPath.Text, Video_UpdateTime = DateTime.Now }; } else { p = new Model.Video { Video_Title = this.txtName.Text, Video_Intro = this.txtIntro.Text, Video_Path = this.textPath.Text, Video_Image = photo, Video_UpdateTime = DateTime.Now }; } var res = VideoSvc.Edit(p); ReturnMsg rm = res > 0 ? new ReturnMsg() { Code = StatusCode.OK, Message = "编辑用户信息成功", Data = null } : new ReturnMsg() { Code = StatusCode.Error, Message = "编辑用户信息失败", Data = null }; Session["Msg"] = rm; //用于传递执行信息的 Response.Redirect("Video_List.aspx"); }