public bool Update(int ID, MD.BlogData update) { var foo = da.BlogDatas.Where(m => m.ID == ID).FirstOrDefault(); foo = update; return(true); }
public bool Add(MD.BlogData add) { var dax = new MD.MVCEntities(); dax.BlogDatas.Add(add); dax.SaveChanges(); //da.BlogDatas.Add(add); return(true); }
//AddBlog public ActionResult AddBlog(MD.BlogData model) { model.BlogID = Convert.ToInt16(Session["bloggerID"]); model.BlogDate = DateTime.UtcNow; model.BlogUser = svc.BlogUserRepo.GetByID(model.BlogID); svc.BlogData.Add(model); //var foo = svc.BlogUser.GetByID(model.BlogID); //var m = new List<MD.BlogData>(); //m.Add(model); //foo.BlogDatas = m; //svc.BlogUser.SaveTheChanges(); var BlogData = svc.BlogData.GetAll(); return(View("ShowBlogPage", BlogData)); }