public IActionResult CreateForm(EditFormModel model) { if (ModelState.IsValid) { var entity = new SystemForm(); model.CopyTo(entity); entity.SystemFormId = Guid.NewGuid(); entity.StateCode = RecordState.Enabled; entity.FormType = (int)FormType.Main; _systemFormCreater.Create(entity); return(CreateSuccess(new { id = entity.SystemFormId })); } return(CreateFailure(GetModelErrors())); }
public IActionResult CopyForm(Guid systemFormId, string name) { string msg = string.Empty; if (!systemFormId.Equals(Guid.Empty)) { var entity = _systemFormFinder.FindById(systemFormId); if (entity != null) { var newForm = new SystemForm(); entity.CopyTo(newForm); newForm.Name = name.IfEmpty(entity.Name + " Copy"); newForm.IsDefault = false; newForm.CreatedBy = CurrentUser.SystemUserId; newForm.CreatedOn = DateTime.Now; newForm.SystemFormId = Guid.NewGuid(); List <Guid> assignRolesId = null; if (entity.AuthorizationEnabled) { var assignRoles = _roleObjectAccessService.Query(entity.SystemFormId, FormDefaults.ModuleName); if (assignRoles.NotEmpty()) { assignRolesId = assignRoles.Select(x => x.RoleId).ToList(); } } _systemFormCreater.Create(newForm); return(SaveSuccess(new { id = entity.SystemFormId })); } } return(SaveFailure()); }
public bool Import(Guid solutionId, List <Domain.SystemForm> systemForms) { if (systemForms.NotEmpty()) { foreach (var item in systemForms) { var entity = _SystemFormFinder.FindById(item.SystemFormId); if (entity != null) { entity.Description = item.Description; entity.FormConfig = item.FormConfig; entity.IsDefault = item.IsDefault; entity.IsCustomButton = item.IsCustomButton; entity.CustomButtons = item.CustomButtons; entity.ModifiedBy = _currentUser.SystemUserId; entity.ModifiedOn = DateTime.Now; entity.Name = item.Name; entity.PublishedOn = DateTime.Now; entity.StateCode = item.StateCode; _SystemFormUpdater.Update(entity, true); } else { item.ComponentState = 0; item.SolutionId = solutionId; item.PublishedOn = DateTime.Now; item.IsCustomizable = true; item.CreatedBy = _currentUser.SystemUserId; _SystemFormCreater.Create(item); } } } return(true); }
public IActionResult CreateDashBoard([FromBody] EditDashBoardModel model) { if (ModelState.IsValid) { var entity = new SystemForm(); model.CopyTo(entity); entity.SystemFormId = Guid.NewGuid(); entity.SolutionId = SolutionId.Value; entity.EntityId = Guid.Empty; entity.StateCode = Core.RecordState.Enabled; entity.FormType = (int)FormType.Dashboard; entity.CreatedBy = CurrentUser.SystemUserId; entity.CreatedOn = DateTime.Now; return(_systemFormCreater.Create(entity).CreateResult(T, new { id = entity.SystemFormId })); } return(CreateFailure(GetModelErrors())); }