//图标类型 public ActionResult EditIconType(long?id) { var data = new IconTypeInput(); if (id != null) { data = _iconAppService.GetIconType(id.Value); // data = _iconTypeAppService.Get(id.Value); } return(View("Easyman.FwWeb.Views.Admin.EditIconType", data)); }
/// <summary> /// 类别新增或修改 /// </summary> /// <param name="input"></param> public void UpdateOrInserIconType(IconTypeInput input) { var type = _iconTypeRepository.GetAll().FirstOrDefault(a => a.Id == input.Id) ?? new IconType(); if (_iconTypeRepository.GetAll().Any(p => p.Id != input.Id && p.Name == input.Name)) { throw new UserFriendlyException("名为【" + input.Name + "】的对象已存在!"); } type.Name = input.Name; type.Remark = input.Remark; var res = _iconTypeRepository.InsertOrUpdate(type); if (res == null) { throw new UserFriendlyException("新增或更新失败!"); } }