public async Task<ActionResult> Create(Page page, Tag tag) { page.created_at = DateTime.UtcNow; page.updated_at = DateTime.UtcNow; int id = await _mLearningService.CreateObject<Page>(page, p => p.id); await _mLearningService.AddTagToPage(tag.id, id); return Json(new JsonActionResult { resultId = id, url = Url.Action("", new { id = id }) }); }
public async Task<ActionResult> Update(Page page, Tag tag) { page.updated_at = DateTime.UtcNow; await _mLearningService.UpdateObject<Page>(page); var tagList = await _mLearningService.GetTagsByPage(page.id); var _pageTag = tagList.First(); if(tag.id != _pageTag.tag_id) { await _mLearningService.DeleteTagFromPage(_pageTag.tag_id, page.id); await _mLearningService.AddTagToPage(tag.id, page.id); } return Json(new JsonActionResult()); }
public ActionResult TagCreate(Tag tag) { try { tag.updated_at = DateTime.UtcNow; tag.created_at = DateTime.UtcNow; _mLearningService.CreateObject<Tag>(tag,t=>t.id); // TODO: Add insert logic here return RedirectToAction("Tags", new { page_id = PageID }); } catch { return View(); } }