public ActionResult Insert(SubCategory 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.AddSubCategory(entity); _service.Save(); } else { X.Msg.Alert(MsgInfo.TI_SHI, MsgInfo.INSERT_CHECK_EXIT_CODE).Show(); return(this.Direct()); } this.GetCmp <Window>("windowSubCategory").Hide(); this.GetCmp <Store>("storeSubCategory").Reload(); return(this.Direct()); } return(this.Direct()); }