public async Task <bool> AddCompanySWOT(SA_Company_SWOT News) { // News.CreatedDate = DateTime.Now; _context.SA_Company_SWOT.Add(News); int x = await _context.SaveChangesAsync(); return(x == 0 ? false : true); }
public bool DeleteCompanySWOT(int NewsId) { // News.CreatedDate = DateTime.Now; SA_Company_SWOT EditNews = _context.SA_Company_SWOT.Where(News => News.Id == NewsId).FirstOrDefault(); _context.Entry(EditNews).State = EntityState.Deleted; int x = _context.SaveChanges(); return(x == 0 ? false : true); }
public ActionResult SaveCompanySWOT(SA_Company_SWOT UserNews) { if (UserNews.Id == 0) { Obj.AddCompanySWOT(UserNews); } else { Obj.EditCompanySWOT(UserNews); } return(RedirectToAction("CompanySWOT")); }
public bool EditCompanySWOT(SA_Company_SWOT News) { // News.CreatedDate = DateTime.Now; SA_Company_SWOT EditNews = _context.SA_Company_SWOT.Where(Cat => Cat.Id == News.Id).FirstOrDefault(); EditNews.CompanyId = News.CompanyId; EditNews.Opportunity = News.Opportunity; EditNews.CompanyExpansionBlock = News.CompanyExpansionBlock; EditNews.Perspective = News.Perspective; EditNews.Strategy = News.Strategy; EditNews.Weakness = News.Weakness; EditNews.Threat = News.Threat; EditNews.Strength = News.Strength; _context.Entry(EditNews).State = EntityState.Modified; int x = _context.SaveChanges(); return(x == 0 ? false : true); }
public ActionResult AddCompanySWOT(int id = 0) { //NewsDataStore ObjDal = new NewsDataStore(); //SA_NewsViewModel objCatViewModel = new SA_NewsViewModel(); //objCatViewModel.ProductList = ObjDal.GetProductList(); //return View("AddIndustry", objCatViewModel); SA_Company_SWOT obj = new SA_Company_SWOT(); if (id > 0) { obj = _context.SA_Company_SWOT.Where(w => w.Id == id).FirstOrDefault(); } if (obj == null) { obj = new SA_Company_SWOT(); } //obj.ProductList = ObjDal.GetProductList(); //SA_Industry obj = new SA_Industry(); return(View(obj)); }