/// <summary>Create missing mappings for a page.</summary> /// <return>The number of inserted mappings.</return> public int ProcessPage(Page page, Lang[] langs) { // don't process ignored pages if (page.IsIgnored) return 0; var maps = page.Mappings; var now = DateTime.UtcNow; var count = 0; // Creating the missing mappings foreach(var lang in langs.Where(x => !maps.Any(y => y.Code == x.Code))) { var mapping = new Mapping { Code = lang.Code, Created = now, Page = page }; page.Mappings.Add(mapping); Mappings.Create(mapping); count++; } return count; }
public void Create(Lang lang) { using (var trans = Session.BeginTransaction()) { Session.Save(lang); trans.Commit(); } }
public void Edit(long id, Lang lang) { using (var trans = Session.BeginTransaction()) { var dbLang = Session.Get<Lang>(id); dbLang.Code = lang.Code; Session.Update(dbLang); trans.Commit(); } }
public ActionResult Edit(long id, Lang lang) { Langs.Edit(id, lang); return RedirectToAction("Index"); }