public ActionResult Insert(Category entity) { if (ModelState.IsValid) { if (_service.GetCategoryByCode(entity.Code) == null) { if (string.IsNullOrEmpty(entity.RecordType)) { entity.RecordType = RecordType.User.ToString(); } entity.CreatedBy = GetCurrentUserName(); entity.CreatedDate = DateTime.Now; _service.AddCategory(entity); _service.Save(); } else { X.Msg.Alert(MsgInfo.TI_SHI, MsgInfo.INSERT_CHECK_EXIT_CODE).Show(); return(this.Direct()); } this.GetCmp <Window>(ExtHelper.windowCategory.ToString()).Hide(); this.GetCmp <Store>(ExtHelper.storeCategory.ToString()).Reload(); return(this.Direct()); } return(this.Direct()); }