public IActionResult EditWorship(VariableEditWorshipModel model) => Perform(() => CommandProcessor.Execute(new EditTypiconWorshipVariableCommand (model.Id , model.Header , model.Description , model.Value)), () => RedirectToAction(nameof(Index), new { id = model.TypiconId }));
private Result <VariableEditModelBase> GetModel(TypiconVariable variable) { VariableEditModelBase result = null; var links = GetLinks(variable); switch (variable.Type) { case VariableType.Worship: { result = new VariableEditWorshipModel() { Id = variable.Id, TypiconId = variable.TypiconVersion.TypiconId, IsTemplate = variable.TypiconVersion.IsTemplate, Name = variable.Name, Type = variable.Type, Header = variable.Header, Description = variable.Description, Count = links.Count, Links = links, Value = Compose(variable.Value) }; break; } case VariableType.Time: default: { result = new VariableEditTimeModel() { Id = variable.Id, TypiconId = variable.TypiconVersion.TypiconId, IsTemplate = variable.TypiconVersion.IsTemplate, Name = variable.Name, Type = variable.Type, Header = variable.Header, Description = variable.Description, Count = links.Count, Links = links, Value = variable.Value }; break; } } return((result != null) ? Result.Ok(result) : Result.Fail <VariableEditModelBase>("Ошибка при формировании объекта.")); }