Esempio n. 1
0
        public ActionResult Create(HeaderedPageModel <CreateNewsViewModel> model, HttpPostedFileBase newsImage)
        {
            //if (ModelState.IsValid)
            //{
            try
            {
                News insertData = new News();

                insertData.Body   = model.PageModel.Body;
                insertData.Header = model.PageModel.Header;
                insertData.SelectedNewsCategory = model.PageModel.SelectedNewsCategory;


                // TODO: Add insert logic here
                string imageName = ManageNewsServices.ConvertToBytes(newsImage);
                insertData.ImageData = imageName;
                ManageNewsServices.FillNewsModelDetails(insertData);
                this.db.News.Add(insertData);
                this.db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                ManageNewsServices.FillNewsTypes(model.PageModel);
                return(View(model));
            }
            //}

            //ManageNewsServices.FillNewsTypes(model);
            //return View(model);
        }
Esempio n. 2
0
        // GET: ManageNews/Create
        public ActionResult Create()
        {
            var model = new CreateNewsViewModel();

            ManageNewsServices.FillNewsTypes(model);

            return(View(new HeaderedPageModel <CreateNewsViewModel>("Yeni Haber Oluştur", model)
            {
            }));
        }