Пример #1
0
        public IActionResult Add(long id, long?languageId, long?languagePairId)
        {
            if (!languageId.HasValue)
            {
                return(RedirectToAction("Add", new { id, languageId = App.Common.Language.Id, languagePairId }));
            }

            if (languagePairId.HasValue)
            {
                var entryId = _dashboardManager.FindPairedEntries(id, languageId.Value, languagePairId.Value);
                if (entryId.HasValue)
                {
                    return(RedirectToAction("Edit", new { id, entryId }));
                }
            }

            var result = _dashboardManager.GetTableAddRecordModel(id, null, languageId);

            result.Language       = _languageManager.GetById(languageId.Value);
            result.LanguagePairId = languagePairId;
            return(View("AddOrEdit", result));
        }