public ActionResult SaveQuote(SA_Quote UserNews)
        {
            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.QuoteImg = fileName;
                }
            }
            UserNews.CreatedTime = DateTime.Now;
            //AdvisoryDataStore Obj = new AdvisoryDataStore();
            if (UserNews.id == 0)
            {
                Obj.AddQuote(UserNews);
            }
            else
            {
                Obj.EditQuote(UserNews);
            }
            return(RedirectToAction("Quote"));
        }
Esempio n. 2
0
        public async Task <bool> UpdateQuote(SA_Quote News)
        {
            _context.Entry(News).State = EntityState.Modified;
            //  News.ModeifiedDate = DateTime.Now;
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Esempio n. 3
0
        public async Task <bool> AddQuote(SA_Quote News)
        {
            //  News.CreatedDate = DateTime.Now;
            _context.SA_Quote.Add(News);
            int x = await _context.SaveChangesAsync();

            return(x == 0 ? false : true);
        }
Esempio n. 4
0
        public bool DeleteQuote(int NewsId)
        {
            //  News.CreatedDate = DateTime.Now;
            SA_Quote EditNews = _context.SA_Quote.Where(News => News.id == NewsId).FirstOrDefault();

            _context.Entry(EditNews).State = EntityState.Deleted;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
Esempio n. 5
0
        public bool EditQuote(SA_Quote News)
        {
            //  News.CreatedDate = DateTime.Now;
            SA_Quote EditNews = _context.SA_Quote.Where(Cat => Cat.id == News.id).FirstOrDefault();

            EditNews.QuoteName             = News.QuoteName;
            EditNews.QuoteDiscription      = News.QuoteDiscription;
            EditNews.QuoteBy               = News.QuoteBy;
            EditNews.QuoteDes              = News.QuoteDes;
            EditNews.Meta                  = News.Meta;
            EditNews.MetaDiscription       = News.MetaDiscription;
            _context.Entry(EditNews).State = EntityState.Modified;
            int x = _context.SaveChanges();

            return(x == 0 ? false : true);
        }
        public ActionResult EditQuote(int id)
        {
            SA_Quote obj = Obj.GetQuoteByid(id);

            return(View("AddQuote", obj));
        }
        public ActionResult AddQuote()
        {
            var Model = new SA_Quote();

            return(View(Model));
        }