Exemplo n.º 1
0
 public ActionResult JieKouRenSettings()
 {
     var model = new JieKouRenSettingsModel();
     model.Unit = new NpcContext().CurrentUser.Unit;
     model.JieKouRenId = model.Unit.JieKouRen != null ? model.Unit.JieKouRen.Id : default(Guid?);
     model.AliasName = model.Unit.AliasName;
     return View(model);
 }
Exemplo n.º 2
0
 public ActionResult JieKouRenSettingsPost(JieKouRenSettingsModel model)
 {
     try
     {
         if (model.JieKouRenId == null)
             throw new ArgumentException("必须设置接口人");
         var unit = new NpcContext().CurrentUser.Unit;
         unit.JieKouRen = _userRepository.Find(model.JieKouRenId.Value);
         unit.AliasName = model.AliasName;
         _unitRepository.Save(unit);
     }
     catch (Exception exception)
     {
         RedirectToMessage(exception.Message);
     }
     return RedirectToMessage("设置完成!");
 }