Exemplo n.º 1
0
        public ActionResult AddTerm(Term term, Termlang lang)
        {
            term.Termid     = Guid.NewGuid();
            term.Uuid       = Guid.NewGuid();
            term.Createdate = DateTime.Now;
            term.Updatedate = DateTime.Now;
            termService.Create(term);
            termService.SaveChanges();

            if (TryUpdateModel(lang, new string[] { "title", "contents" }) && ModelState.IsValid)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
                return(RedirectToAction("Term"));
            }
            else
            {
                lang.Langid = 1;
                lang.Termid = term.Termid;
                termlangService.Create(lang);
                termlangService.SaveChanges();
                return(RedirectToAction("Term"));
            }
        }