public JsonResult Edit(SysAccount model) { try { if (model.SysAccountId > 0) { var entity = _SysAccountService.GetById(model.SysAccountId); //修改 entity.EditTime = DateTime.Now; entity.NickName = model.NickName; entity.MobilePhone = model.MobilePhone; entity.BaseImageId = model.BaseImageId; entity.Remarks = model.Remarks; _SysAccountService.Update(entity); } else { //添加 model.PassWord = MD5Util.GetMD5_32(model.PassWord); model.EditTime = DateTime.Now; model.CreateTime = DateTime.Now; model.IsDelete = (int)IsDeleteEnum.效; model.Status = (int)EnabledEnum.效; _SysAccountService.Insert(model); } return(Json(new { Status = Successed.Ok }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { Status = Successed.Error }, JsonRequestBehavior.AllowGet)); } }
public JsonResult CreateBusinessAccount(int id) { try { var businessModel = _businessInfoService.GetById(id); if (businessModel != null && businessModel.BusinessInfoId > 0) { //创建商家帐号实体模型 var model = new SysAccount(); var _date = DateTime.Now; model.Account = "yssgadmin" + businessModel.BusinessInfoId; model.NickName = businessModel.Name; model.PassWord = MD5Util.GetMD5_32("123456"); model.MobilePhone = businessModel.Mobile; model.SysRoleId = (int)RoleTypeEnum.商家; model.BusinessInfoId = businessModel.BusinessInfoId; model.BaseImageId = businessModel.BaseImageId; model.Status = (int)EnabledEnum.效; model.IsDelete = (int)IsDeleteEnum.效; model.CreateTime = _date; model.EditTime = _date; model.LoginTime = _date; //添加 _sysAccountService.Insert(model); } else { return(Json(new { Status = Successed.Error }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { Status = Successed.Error }, JsonRequestBehavior.AllowGet)); } return(Json(new { Status = Successed.Ok }, JsonRequestBehavior.AllowGet)); }