Example #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("CreatedBy,CreatedAt,ChangedBy,ChangedAt,Id")] LangStr langStr)
        {
            if (id != langStr.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(langStr);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LangStrExists(langStr.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(langStr));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("CreatedBy,CreatedAt,ChangedBy,ChangedAt,Id")] LangStr langStr)
        {
            if (ModelState.IsValid)
            {
                langStr.Id = Guid.NewGuid();
                _context.Add(langStr);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(langStr));
        }
        private static ListOfLangStr getDescription(UANode node)
        {
            //Parent (node)
            //  -> AASLangStrSet (val)  (multiple)
            //      -> Language (var)
            //      -> String   (var)

            ListOfLangStr str = new ListOfLangStr();

            foreach (Reference _ref in node.References)
            {
                if (_ref.ReferenceType != "HasTypeDefinition")
                {
                    UANode  val = findNode(_ref.Value);
                    LangStr v   = new LangStr();
                    foreach (Reference _refref in val.References)
                    {
                        if (_refref.ReferenceType != "HasTypeDefinition")
                        {
                            UAVariable var = (UAVariable)findNode(_refref.Value);
                            if (var.BrowseName == "1:Language")
                            {
                                v.lang = var.Value.InnerText;
                            }
                            if (var.BrowseName == "1:String")
                            {
                                v.str = var.Value.InnerText;
                            }
                        }
                    }
                    str.Add(v);
                }
            }

            return(str);
        }