public ActionResult Edit(CS_Post_Info post, List <string> slides) { post.Create_By = 1; post.Create_Date = DateTime.Now; post.Update_By = 1; post.Update_Date = DateTime.Now; post.Meta_Desc = Request.Form["MetaDesc"]; post.Meta_Key = Request.Form["MetaKey"]; post.Item_ID = Convert.ToInt32(Request.Form["Item_Id"]); post.Avatar = Request.Form["avatar"]; db.Entry(post).State = EntityState.Modified; deleteSlides(post.Post_Id); insertSlides(post.Post_Id, slides); db.SaveChanges(); return(RedirectToAction("Index", new { id = Session["id"] })); }
public ActionResult Create(CS_Post_Info objInfo, List <String> slides) { CS_Post_Info newObj = new CS_Post_Info(); int id = new App_Auto_NumberController().GenID("CS_Posts_Info.Post_Id"); newObj.Post_Id = id; newObj.Create_Date = DateTime.Now; newObj.Update_Date = DateTime.Now; newObj.Enable = objInfo.Enable; newObj.Item_ID = Convert.ToInt32(Request.Form["Item_Id"]); newObj.Language = Request.Form["Language"]; newObj.Meta_Desc = Request.Form["MetaDesc"]; newObj.Meta_Key = Request.Form["MetaKey"]; newObj.Post_Content = Request.Unvalidated["Post_Content"]; newObj.Post_Title = objInfo.Post_Title; newObj.Gia = objInfo.Gia; newObj.Dathue = objInfo.Dathue; newObj.Avatar = Request.Form["avatar"]; db.CS_Post_Info.Add(newObj); insertSlides(id, slides); db.SaveChanges(); return(RedirectToAction("Index", "BaiVietMVC", new { id = Session["id"] })); }