图书管理系统-用户信息维护-修改



publicActionResult saceUpdataUser(S_User User, HttpPostedFileBase upImage, UserVo userVo)
{
ReturnJsonVo RtJson = newReturnJsonVo();//创建对象
//数据验证
if (!string.IsNullOrEmpty(User.userName))
{
if (!string.IsNullOrEmpty(User.account))
{
if (!string.IsNullOrEmpty(User.password))
{
if (User.roleId >0)
{
//将上传的图片文件放到项目指定位置并将图片信息保存到student对象
//1.检查文件存储目录是否不存在
if (!Directory.Exists(Server.MapPath("~/Document/UserPicture/")))
{
//不存在存储目录,则需要创建目录
Directory.CreateDirectory(Server.MapPath("~/Document/UserPicture/"));
}
try
{
//根据学生ID查询学生图片信息
var UserPic = (from tbUser in Mymodel.S_User
where tbUser.userId ==User.userId
selectnew
{
tbUser.userPic,
tbUser.userPicture,
}).Single();
//判断是否上传了图片
if (upImage != null &&upImage.ContentLength > 0)
{
//修改了图片,需要将原图片从studentPicture目录中删除
//判断图片文件是否存在studentPicture目录下
if (System.IO.File.Exists(Server.MapPath("~/Document/UserPicture/") +UserPic.userPicture))
{
System.IO.File.Delete(


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部