public ActionResult EditCommentary(int id) { CommentaryDataStore Obj = new CommentaryDataStore(); SA_Commentary obj = Obj.GetCommentaryByid(id); return(View("AddIndustry", obj)); }
public ActionResult SaveCommentaryMarket(SA_Commentary UserNews) { CommentaryDataStore Obj = new CommentaryDataStore(); for (int i = 0; i < Request.Files.Count; i++) { var file = Request.Files[i]; if (file != null && file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/ProductImages"), fileName); file.SaveAs(path); UserNews.ImgPath = fileName; } } if (UserNews.id == 0) { UserNews.Type = "Market Analysis"; Obj.AddCommentary(UserNews); } else { Obj.EditCommentary(UserNews); } return(RedirectToAction("ShowCommentaryList", "Admin")); }
public async Task <bool> UpdateCommentary(SA_Commentary News) { _context.Entry(News).State = EntityState.Modified; // News.ModeifiedDate = DateTime.Now; int x = await _context.SaveChangesAsync(); return(x == 0 ? false : true); }
public bool DeleteCommentary(int NewsId) { // News.CreatedDate = DateTime.Now; SA_Commentary EditNews = _context.SA_Commentary.Where(News => News.id == NewsId).FirstOrDefault(); _context.Entry(EditNews).State = EntityState.Deleted; int x = _context.SaveChanges(); return(x == 0 ? false : true); }
public async Task <bool> AddCommentary(SA_Commentary News) { News.IsActive = true; News.IsDelete = false; News.CreatedTime = News.CreatedTime != null? News.CreatedTime: DateTime.Now; _context.SA_Commentary.Add(News); int x = await _context.SaveChangesAsync(); return(x == 0 ? false : true); }
public ActionResult AddCommentaryMarket(int id = 0) { CommentaryDataStore Obj = new CommentaryDataStore(); SA_Commentary obj = new SA_Commentary(); if (id > 0) { obj = Obj.GetCommentaryByid(id); } if (obj == null) { obj = new SA_Commentary(); } return(View(obj)); }
public bool EditCommentary(SA_Commentary News) { SA_Commentary EditNews = _context.SA_Commentary.Where(Cat => Cat.id == News.id).FirstOrDefault(); EditNews.Title = News.Title; EditNews.Description = News.Description; EditNews.Meta = News.Meta; EditNews.MetaDescription = News.MetaDescription; EditNews.IsActive = News.IsActive; EditNews.IsDelete = News.IsDelete; EditNews.Product = News.Product; EditNews.ImgPath = News.ImgPath; EditNews.CreatedTime = News.CreatedTime; _context.Entry(EditNews).State = EntityState.Modified; int x = _context.SaveChanges(); return(x == 0 ? false : true); }