public ActionResult ChuyenChuyenMuc() { ModelV2 _db2 = new ModelV2(); var model = _db2.Contents.ToList(); foreach (var item in model) { item.alias = RemoveSign4VietnameseString(item.name).ToLower().Replace("--", "-") + "-" + item.contentId; _db2.Contents.Attach(item); _db2.Entry(item).State = EntityState.Modified; _db2.SaveChanges(); } return(View()); }
public ActionResult ChuyenTinTuc() { ModelV1 _db1 = new ModelV1(); ModelV2 _db2 = new ModelV2(); var post = _db1.Posts.Where(x => x.PostTypeId == 0); foreach (var item in post) { var model = new Content(); model.alias = ""; model.allowComment = false; model.approved = true; model.approvedTime = item.ApprovedDate; model.approvedUser = "******"; model.authorName = "admin"; model.contentKey = "TinTuc"; model.contentMain = item.Content; model.createTime = item.CreatedDate; model.createUser = "******"; model.description = ""; model.isFeature = false; model.isHome = false; model.isNew = false; model.isSort = 0; model.isTrash = false; model.isView = item.Views; model.languageId = 1; model.metaDescription = ""; model.metaKeyword = ""; model.metaTitle = ""; model.modifiedTime = item.ModifiedDate; model.modifiedUser = "******"; model.name = item.Title; model.ngayDang = item.CreatedDate; model.oldId = (int)item.ID; model.parentId = 0; model.thumbnail = item.Thumbnail; _db2.Contents.Add(model); _db2.SaveChanges(); } return(View()); }