public ActionResult Insert(Video videoEntity)
        {
            if (videoEntity.url_tr != null && videoEntity.url_en != null && videoEntity.url_ru != null)
            {
                string embedYoutubeUrlTr = YoutubeURLConverter(videoEntity.url_tr);
                string embedYoutubeUrlEn = YoutubeURLConverter(videoEntity.url_en);
                string embedYoutubeUrlRu = YoutubeURLConverter(videoEntity.url_ru);

                if (embedYoutubeUrlTr != "" && embedYoutubeUrlEn != "" && embedYoutubeUrlRu != "")
                {
                    BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();
                    videoEntity.embedcode_tr = embedYoutubeUrlTr;
                    videoEntity.embedcode_en = embedYoutubeUrlEn;
                    videoEntity.embedcode_ru = embedYoutubeUrlRu;
                    videoEntity.createTime   = DateTime.Now;

                    entities.Video.Add(videoEntity);
                    entities.SaveChanges();
                    Session["status"] = "success";
                }
                else
                {
                    Session["status"] = "error";
                }
            }
            else
            {
                Session["status"] = "noChange";
            }

            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult Create(MagazineCategory magazineCategoryEntity)
        {
            BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();
            var categoryNamesThatEqualNew       = entities.MagazineCategory.Where(w => w.text == magazineCategoryEntity.text);


            if (magazineCategoryEntity.text == null)
            {
                Session["status"] = "error";
                return(RedirectToAction("Index"));
            }

            if (magazineCategoryEntity.text.Length < 3)
            {
                Session["status"] = "error";
                return(RedirectToAction("Index"));
            }

            if (categoryNamesThatEqualNew.Count() != 0)
            {
                Session["status"] = "foundEqual";
            }
            else
            {
                entities.MagazineCategory.Add(magazineCategoryEntity);
                entities.SaveChanges();

                Session["status"] = "success";
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Update(Magazines magazineEntity, MagazinesContent magazineContentEntity, HttpPostedFileBase image_tr, HttpPostedFileBase image_en, HttpPostedFileBase image_ru, HttpPostedFileBase pdf_tr, HttpPostedFileBase pdf_en, HttpPostedFileBase pdf_ru)
        {
            BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();

            var magazineContentTheUpdate = entities.MagazinesContent.Where(w => w.id == magazineContentEntity.id).FirstOrDefault();

            if (image_tr != null)
            {
                string imagePath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_tr.FileName));
                magazineContentTheUpdate.imageFile_tr = ConvertByte(imagePath, image_tr);
            }
            if (image_en != null)
            {
                string imagePath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_en.FileName));
                magazineContentTheUpdate.imageFile_en = ConvertByte(imagePath, image_en);
            }
            if (image_ru != null)
            {
                string imagePath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_ru.FileName));
                magazineContentTheUpdate.imageFile_ru = ConvertByte(imagePath, image_ru);
            }


            if (pdf_tr != null)
            {
                string pdfPath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(pdf_tr.FileName));
                magazineContentTheUpdate.pdfFile_tr = ConvertByte(pdfPath, pdf_tr);
            }
            if (pdf_en != null)
            {
                string pdfPath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(pdf_en.FileName));
                magazineContentTheUpdate.pdfFile_en = ConvertByte(pdfPath, pdf_en);
            }
            if (pdf_ru != null)
            {
                string pdfPath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(pdf_ru.FileName));
                magazineContentTheUpdate.pdfFile_ru = ConvertByte(pdfPath, pdf_ru);
            }


            magazineContentTheUpdate.imageName_tr = magazineContentEntity.imageName_tr;
            magazineContentTheUpdate.imageName_en = magazineContentEntity.imageName_en;
            magazineContentTheUpdate.imageName_ru = magazineContentEntity.imageName_ru;
            magazineContentTheUpdate.pdfName_tr   = magazineContentEntity.pdfName_tr;
            magazineContentTheUpdate.pdfName_en   = magazineContentEntity.pdfName_en;
            magazineContentTheUpdate.pdfName_ru   = magazineContentEntity.pdfName_ru;
            magazineContentTheUpdate.title_tr     = magazineContentEntity.title_tr;
            magazineContentTheUpdate.title_en     = magazineContentEntity.title_en;
            magazineContentTheUpdate.title_ru     = magazineContentEntity.title_ru;
            magazineContentTheUpdate.categoryId   = magazineContentEntity.categoryId;

            magazineContentTheUpdate.updateTime = DateTime.Now;

            entities.SaveChanges();

            Session["status"] = "success";


            return(RedirectToAction("Index"));
        }
        public ActionResult Index()
        {
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();
            List <SelectListItem>      items     = new List <SelectListItem>();
            SelectListItem             item1     = new SelectListItem()
            {
                Text = "Türkçe", Value = "1", Selected = false
            };
            SelectListItem item2 = new SelectListItem()
            {
                Text = "İngilizce", Value = "2", Selected = false
            };
            SelectListItem item3 = new SelectListItem()
            {
                Text = "Rusça", Value = "3", Selected = true
            };

            items.Add(item1);
            items.Add(item2);
            items.Add(item3);

            ViewBag.LanguageItem = items;
            ViewBag.Status       = Session["status"];
            ViewBag.Language     = Session["language"];
            Session["status"]    = null;
            Session["language"]  = null;



            // BlueprintMediaServis.Models.Magazines
            return(View(Tuple.Create <Catalog, IEnumerable <Catalog> >(new Catalog(), BMSentity.Catalog.ToList())));
        }
        public ActionResult Index()
        {
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();

            ViewBag.Entity    = Session["entity"];
            ViewBag.Status    = Session["status"];
            Session["entity"] = null;
            Session["status"] = null;

            Menu        menu     = new Menu();
            List <Menu> menuList = new List <Menu>();

            if (ViewBag.Entity != null)
            {
                menu.content_tr = ViewBag.Entity.content_tr;
                menu.content_en = ViewBag.Entity.content_en;
                menu.content_ru = ViewBag.Entity.content_ru;
                menuList.Add(menu);

                return(View(Tuple.Create <Menu, IEnumerable <Menu> >(new Menu(), menuList)));
            }
            else
            {
                menu.content_tr = "";
                menu.content_en = "";
                menu.content_ru = "";
                menuList.Add(menu);
                return(View(Tuple.Create <Menu, IEnumerable <Menu> >(new Menu(), menuList)));
            }
        }
        // GET: Contact
        public ActionResult Index()
        {
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();

            ViewBag.Entity    = Session["entity"];
            ViewBag.Status    = Session["status"];
            Session["entity"] = null;
            Session["status"] = null;

            Contact        contact     = new Contact();
            List <Contact> contactList = new List <Contact>();

            if (ViewBag.Entity != null)
            {
                contact.adress_tr = ViewBag.Entity.adress_tr;
                contact.adress_en = ViewBag.Entity.adress_en;
                contact.adress_ru = ViewBag.Entity.adress_ru;
                contactList.Add(contact);

                return(View(Tuple.Create <Contact, IEnumerable <Contact> >(new Contact(), contactList)));
            }
            else
            {
                contact.adress_tr = "";
                contact.adress_en = "";
                contact.adress_ru = "";
                contactList.Add(contact);
                return(View(Tuple.Create <Contact, IEnumerable <Contact> >(new Contact(), contactList)));
            }
        }
Example #7
0
        public ActionResult Update(MagazineCategory magazineCategory)
        {
            BlueprintMediaServisEntity entity = new BlueprintMediaServisEntity();
            var categoryNamesThatEqualNew     = entity.MagazineCategory.Where(w => w.text == magazineCategory.text);
            var magazineCategoryTheUpdate     = entity.MagazineCategory.Where(w => w.id == magazineCategory.id).FirstOrDefault();

            if (categoryNamesThatEqualNew.Count() == 0)
            {
                magazineCategoryTheUpdate.text = magazineCategory.text;

                entity.SaveChanges();
                Session["Status"] = "success";
                return(RedirectToAction("Index"));
            }
            else if (categoryNamesThatEqualNew.Count() == 1 && categoryNamesThatEqualNew.First().text == magazineCategoryTheUpdate.text)
            {
                Session["Status"] = "noChange";
                return(RedirectToAction("Index"));
            }
            else
            {
                Session["Status"] = "failed";
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Index()
        {
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();

            ViewBag.Entity    = Session["entity"];
            ViewBag.Status    = Session["status"];
            Session["entity"] = null;
            Session["status"] = null;

            BoardMembers        boardMembers     = new BoardMembers();
            List <BoardMembers> boardMembersList = new List <BoardMembers>();

            if (ViewBag.Entity != null)
            {
                boardMembers.content_tr = ViewBag.Entity.content_tr;
                boardMembers.content_en = ViewBag.Entity.content_en;
                boardMembers.content_ru = ViewBag.Entity.content_ru;
                boardMembersList.Add(boardMembers);

                return(View(Tuple.Create <BoardMembers, IEnumerable <BoardMembers> >(new BoardMembers(), boardMembersList)));
            }
            else
            {
                boardMembers.content_tr = "";
                boardMembers.content_en = "";
                boardMembers.content_ru = "";
                boardMembersList.Add(boardMembers);
                return(View(Tuple.Create <BoardMembers, IEnumerable <BoardMembers> >(new BoardMembers(), boardMembersList)));
            }
        }
 public ActionResult Insert(Contact contactEntity)
 {
     if (contactEntity.slug == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingSlug";
     }
     else if (contactEntity.name_tr == null || contactEntity.name_en == null || contactEntity.name_ru == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingName";
     }
     else if (contactEntity.statu_tr == null || contactEntity.statu_en == null || contactEntity.statu_ru == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingStatu";
     }
     else if (contactEntity.phone_tr == null || contactEntity.phone_en == null || contactEntity.phone_ru == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingPhone";
     }
     else if (contactEntity.fax_tr == null || contactEntity.fax_en == null || contactEntity.fax_ru == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingFax";
     }
     else if (contactEntity.mail_tr == null || contactEntity.mail_en == null || contactEntity.mail_ru == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingMail";
     }
     else if (contactEntity.city_tr == null || contactEntity.city_en == null || contactEntity.city_ru == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingCity";
     }
     else if (contactEntity.country_tr == null || contactEntity.country_en == null || contactEntity.country_ru == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingCountry";
     }
     else if (contactEntity.adress_tr == null || contactEntity.adress_en == null || contactEntity.adress_ru == null)
     {
         Session["entity"] = contactEntity;
         Session["status"] = "missingAdress";
     }
     else
     {
         BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();
         entities.Contact.Add(contactEntity);
         entities.SaveChanges();
         Session["status"] = "success";
     }
     return(RedirectToAction("Index"));
 }
Example #10
0
        // GET: PagesList
        public ActionResult Index()
        {
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();
            var model = BMSentity.Menu;

            ViewBag.Status    = Session["status"];
            Session["status"] = null;

            return(View(model));
        }
Example #11
0
        // GET: MagazineCategory
        public ActionResult Index()
        {
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();

            ViewBag.Status    = Session["status"];
            Session["status"] = null;


            return(View(Tuple.Create <MagazineCategory, IEnumerable <MagazineCategory> >(new MagazineCategory(), BMSentity.MagazineCategory.ToList())));
        }
        public ActionResult Index()
        {
            BlueprintMediaServisEntity   BMSentity = new BlueprintMediaServisEntity();
            MagazineCategory             magazineCategoryEntity         = new MagazineCategory();
            IEnumerable <SelectListItem> enumarableMagazineCategoryList = magazineCategoryEntity.RetrieveMagazineCategory();

            ViewBag.Status    = Session["status"];
            Session["status"] = null;

            return(View(Tuple.Create <Magazines, IEnumerable <Magazines>, MagazinesContent, IEnumerable <SelectListItem> >(new Magazines(), BMSentity.Magazines.ToList(), new MagazinesContent(), enumarableMagazineCategoryList)));
        }
Example #13
0
        // GET: UpdateContact
        public ActionResult Index()
        {
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();
            var query  = BMSentity.Contact.ToList();
            var result = query.Where(m => m.id == (int)Session["id"]).ToList();

            ViewBag.Status    = Session["status"];
            Session["status"] = null;

            return(View(Tuple.Create <Contact, IEnumerable <Contact> >(new Contact(), result)));
        }
Example #14
0
        public ActionResult Update(Contact contactEntity)
        {
            BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();

            var contactTheUpdate = entities.Contact.Where(w => w.id == contactEntity.id).FirstOrDefault();

            if (contactTheUpdate != null)
            {
                contactTheUpdate.slug = contactEntity.slug;

                contactTheUpdate.name_tr = contactEntity.name_tr;
                contactTheUpdate.name_en = contactEntity.name_en;
                contactTheUpdate.name_ru = contactEntity.name_ru;

                contactTheUpdate.statu_tr = contactEntity.statu_tr;
                contactTheUpdate.statu_en = contactEntity.statu_en;
                contactTheUpdate.statu_ru = contactEntity.statu_ru;

                contactTheUpdate.phone_tr = contactEntity.phone_tr;
                contactTheUpdate.phone_en = contactEntity.phone_en;
                contactTheUpdate.phone_ru = contactEntity.phone_ru;

                contactTheUpdate.fax_tr = contactEntity.fax_tr;
                contactTheUpdate.fax_en = contactEntity.fax_en;
                contactTheUpdate.fax_ru = contactEntity.fax_ru;

                contactTheUpdate.mail_tr = contactEntity.mail_tr;
                contactTheUpdate.mail_en = contactEntity.mail_en;
                contactTheUpdate.mail_ru = contactEntity.mail_ru;

                contactTheUpdate.city_tr = contactEntity.city_tr;
                contactTheUpdate.city_en = contactEntity.city_en;
                contactTheUpdate.city_ru = contactEntity.city_ru;

                contactTheUpdate.country_tr = contactEntity.country_tr;
                contactTheUpdate.country_en = contactEntity.country_en;
                contactTheUpdate.country_ru = contactEntity.country_ru;

                contactTheUpdate.adress_tr = contactEntity.adress_tr;
                contactTheUpdate.adress_en = contactEntity.adress_en;
                contactTheUpdate.adress_ru = contactEntity.adress_ru;

                entities.SaveChanges();
                Session["status"] = "success";
            }
            else
            {
                Session["status"] = "itemNotFound";
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult RetrieveSingle(int id)
        {
            BlueprintMediaServisEntity entity = new BlueprintMediaServisEntity();
            var query  = entity.Catalog.ToList();
            var result = query.Where(m => m.id == id).ToList();

            ViewData["ttle"]      = result[0].title;
            ViewData["imageName"] = result[0].imageName;

            ViewData["pdfName"] = result[0].pdfName;
            ViewData["id"]      = result[0].id;

            return(PartialView("UpdateCatalog", result[0]));
        }
        public Video RetrieveSingle()
        {
            BlueprintMediaServisEntity entity = new BlueprintMediaServisEntity();
            var query  = entity.Video.ToList();
            var query2 = query.OrderByDescending(v => v.id);
            var result = query2.FirstOrDefault();

            if (result != null)
            {
                return(result);
            }

            return(null);
        }
        public ActionResult DisplayPDF(int id)
        {
            var entity = new BlueprintMediaServisEntity();
            var query  = entity.MagazinesContent.ToList();
            var result = query.Where(m => m.id == id).ToList();

            byte[]       byteArray = result.Select(m => m.pdfFile_tr).First();
            MemoryStream pdfStream = new MemoryStream();

            pdfStream.Write(byteArray, 0, byteArray.Length);
            pdfStream.Position = 0;

            return(new FileStreamResult(pdfStream, "application/pdf"));
        }
        public ActionResult Update(BoardMembers valuesEntity, HttpPostedFileBase image_tr6, HttpPostedFileBase image_en6, HttpPostedFileBase image_ru6)
        {
            BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();

            var boardMemberTheUpdate = entities.BoardMembers.Where(w => w.id == valuesEntity.id).FirstOrDefault();

            if (image_tr6 != null)
            {
                string imagePath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_tr6.FileName));
                boardMemberTheUpdate.image_tr = ConvertByte(imagePath, image_tr6);
            }
            if (image_en6 != null)
            {
                string imagePath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_en6.FileName));
                boardMemberTheUpdate.image_en = ConvertByte(imagePath, image_en6);
            }
            if (image_ru6 != null)
            {
                string imagePath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_ru6.FileName));
                boardMemberTheUpdate.image_ru = ConvertByte(imagePath, image_ru6);
            }
            if (boardMemberTheUpdate != null)
            {
                boardMemberTheUpdate.imageName_tr = valuesEntity.imageName_tr;
                boardMemberTheUpdate.imageName_en = valuesEntity.imageName_en;
                boardMemberTheUpdate.imageName_ru = valuesEntity.imageName_ru;

                boardMemberTheUpdate.name_tr     = valuesEntity.name_tr;
                boardMemberTheUpdate.content_tr  = valuesEntity.content_tr;
                boardMemberTheUpdate.position_tr = valuesEntity.position_tr;

                boardMemberTheUpdate.name_en     = valuesEntity.name_en;
                boardMemberTheUpdate.content_en  = valuesEntity.content_en;
                boardMemberTheUpdate.position_en = valuesEntity.position_en;

                boardMemberTheUpdate.name_ru     = valuesEntity.name_ru;
                boardMemberTheUpdate.content_ru  = valuesEntity.content_ru;
                boardMemberTheUpdate.position_ru = valuesEntity.position_ru;

                entities.SaveChanges();
                Session["status"] = "success";
            }
            else
            {
                Session["status"] = "itemNotFound";
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult MenuPage(int id)
        {
            var entity = new BlueprintMediaServisEntity();
            var query  = entity.Menu.ToList();
            var result = query.Where(m => m.id == id).ToList();

            ViewData["name_tr"]    = result[0].name_tr;
            ViewData["content_tr"] = result[0].content_tr;
            ViewData["name_en"]    = result[0].name_en;
            ViewData["content_en"] = result[0].content_en;
            ViewData["name_ru"]    = result[0].name_ru;
            ViewData["content_ru"] = result[0].content_ru;

            return(View());
        }
        public ActionResult Index()
        {
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();
            MagazineCategory           magazineCategoryEntity = new MagazineCategory();

            IEnumerable <SelectListItem> enumarableMagazineCategoryList = magazineCategoryEntity.RetrieveMagazineCategory();

            var query  = BMSentity.MagazinesContent.ToList();
            var result = query.Where(m => m.id == (int)Session["id"]).ToList();


            ViewData["category"] = result[0].categoryId;


            return(View(Tuple.Create <MagazinesContent, IEnumerable <SelectListItem>, IEnumerable <MagazinesContent> >(new MagazinesContent(), enumarableMagazineCategoryList, result)));
        }
        public ActionResult Insert(Menu menuEntity, HttpPostedFileBase image_tr5, HttpPostedFileBase image_en5, HttpPostedFileBase image_ru5)
        {
            if (image_tr5 != null)
            {
                string imagePath_tr = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_tr5.FileName));
                menuEntity.image_tr = ConvertByte(imagePath_tr, image_tr5);
            }

            if (image_en5 != null)
            {
                string imagePath_en = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_en5.FileName));
                menuEntity.image_en = ConvertByte(imagePath_en, image_en5);
            }

            if (image_ru5 != null)
            {
                string imagePath_ru = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_ru5.FileName));
                menuEntity.image_ru = ConvertByte(imagePath_ru, image_ru5);
            }

            if (menuEntity.slug == null)
            {
                Session["entity"] = menuEntity;
                Session["status"] = "missingSlug";
            }
            else if (menuEntity.name_tr == null || menuEntity.name_en == null || menuEntity.name_ru == null)
            {
                Session["entity"] = menuEntity;
                Session["status"] = "missingTitle";
            }
            else if (menuEntity.content_tr == null || menuEntity.content_en == null || menuEntity.content_ru == null)
            {
                Session["entity"] = menuEntity;
                Session["status"] = "missingContent";
            }
            else
            {
                BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();
                menuEntity.createTime = DateTime.Now;
                entities.Menu.Add(menuEntity);
                entities.SaveChanges();
                Session["status"] = "success";
            }


            return(RedirectToAction("Index"));
        }
        public ActionResult Insert(BoardMembers boardMembersEntity, HttpPostedFileBase image_tr7, HttpPostedFileBase image_en7, HttpPostedFileBase image_ru7)
        {
            if (image_tr7 != null)
            {
                string imagePath_tr = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_tr7.FileName));
                boardMembersEntity.image_tr = ConvertByte(imagePath_tr, image_tr7);
            }

            if (image_en7 != null)
            {
                string imagePath_en = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_en7.FileName));
                boardMembersEntity.image_en = ConvertByte(imagePath_en, image_en7);
            }

            if (image_ru7 != null)
            {
                string imagePath_ru = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image_ru7.FileName));
                boardMembersEntity.image_ru = ConvertByte(imagePath_ru, image_ru7);
            }

            if (boardMembersEntity.name_tr == null || boardMembersEntity.name_en == null || boardMembersEntity.name_ru == null)
            {
                Session["entity"] = boardMembersEntity;
                Session["status"] = "missingname";
            }
            else if (boardMembersEntity.position_tr == null || boardMembersEntity.position_en == null || boardMembersEntity.position_ru == null)
            {
                Session["entity"] = boardMembersEntity;
                Session["status"] = "missingPosition";
            }
            else if (boardMembersEntity.content_tr == null || boardMembersEntity.content_en == null || boardMembersEntity.content_ru == null)
            {
                Session["entity"] = boardMembersEntity;
                Session["status"] = "missingContent";
            }
            else
            {
                BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();
                boardMembersEntity.createTime = DateTime.Now;
                entities.BoardMembers.Add(boardMembersEntity);
                entities.SaveChanges();
                Session["status"] = "success";
            }


            return(RedirectToAction("Index"));
        }
        public ActionResult Update(Catalog catalogEntity, HttpPostedFileBase image, HttpPostedFileBase pdf)
        {
            BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity();

            var catalogTheUpdate = entities.Catalog.Where(w => w.language == catalogEntity.language.ToString()).FirstOrDefault();
            int counter          = 0;

            if (image != null)
            {
                string imagePath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image.FileName));
                catalogTheUpdate.imageFile = ConvertByte(imagePath, image);
                catalogTheUpdate.imageName = catalogEntity.imageName;
                counter++;
            }

            if (pdf != null)
            {
                string pdfPath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(pdf.FileName));
                catalogTheUpdate.pdfFile = ConvertByte(pdfPath, pdf);
                catalogTheUpdate.pdfName = catalogEntity.pdfName;
                counter++;
            }

            if (catalogEntity.title != null)
            {
                catalogTheUpdate.title = catalogEntity.title;
                counter++;
            }

            catalogTheUpdate.createTime = DateTime.Now;

            entities.SaveChanges();

            if (counter != 0)
            {
                Session["status"]   = "success";
                Session["language"] = catalogEntity.language;
            }
            else
            {
                Session["status"] = "noChange";
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Insert(Catalog catalogEntity, HttpPostedFileBase image, HttpPostedFileBase pdf)
        {
            string imagePath = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image.FileName));
            string pdfPath   = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(pdf.FileName));

            using (BlueprintMediaServisEntity entities = new BlueprintMediaServisEntity())
            {
                catalogEntity.imageFile = ConvertByte(imagePath, image);
                catalogEntity.pdfFile   = ConvertByte(pdfPath, pdf);

                catalogEntity.createTime = DateTime.Now;

                entities.Catalog.Add(catalogEntity);
                entities.SaveChanges();
            }

            return(Redirect(Request.UrlReferrer.ToString()));
        }
        public ActionResult DeleteContact(int id)
        {
            BlueprintMediaServisEntity entity = new BlueprintMediaServisEntity();
            Contact contactEntity             = entity.Contact.Find(id);

            if (contactEntity != null)
            {
                Contact contact = entity.Contact.Find(contactEntity.id);
                entity.Contact.Remove(contact);
                entity.SaveChanges();
                Session["status"] = "deleted";
                return(RedirectToAction("Index"));
            }
            else
            {
                Session["status"] = "itemNotFound";
            }

            return(RedirectToAction("Index"));
        }
Example #26
0
        public ActionResult DeleteValue(int id)
        {
            BlueprintMediaServisEntity entity = new BlueprintMediaServisEntity();
            BoardMembers boardMembersEntity   = entity.BoardMembers.Find(id);

            if (boardMembersEntity != null)
            {
                BoardMembers boardMembers = entity.BoardMembers.Find(boardMembersEntity.id);
                entity.BoardMembers.Remove(boardMembers);
                entity.SaveChanges();
                Session["status"] = "deleted";
                return(RedirectToAction("Index"));
            }
            else
            {
                Session["status"] = "itemNotFound";
            }

            return(RedirectToAction("Index"));
        }
Example #27
0
        public ActionResult DeletePage(int id)
        {
            BlueprintMediaServisEntity entity = new BlueprintMediaServisEntity();
            Menu menuEntity = entity.Menu.Find(id);

            if (menuEntity != null)
            {
                Menu menu = entity.Menu.Find(menuEntity.id);
                entity.Menu.Remove(menu);
                entity.SaveChanges();
                Session["status"] = "deleted";
                return(RedirectToAction("Index"));
            }
            else
            {
                Session["status"] = "itemNotFound";
            }

            return(RedirectToAction("Index"));
        }
Example #28
0
        public async Task <ActionResult> Login(User userEntity, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(userEntity));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            BlueprintMediaServisEntity BMSentity = new BlueprintMediaServisEntity();
            var result = BMSentity.User.FirstOrDefault(temp => temp.userName == userEntity.userName && temp.password == userEntity.password);

            if (result != null)
            {
                Session["authenticationResult"] = true;
                return(RedirectToAction("Index", "Home"));
            }

            ModelState.AddModelError("", "Kullanıcı adı yada şifre yanlış.");
            return(View(userEntity));
        }
        public ActionResult Delete(int id)
        {
            BlueprintMediaServisEntity entity          = new BlueprintMediaServisEntity();
            MagazinesContent           magazineContent = entity.MagazinesContent.Find(id);


            if (magazineContent != null)
            {
                Magazines magazine = entity.Magazines.Find(magazineContent.magazineId);
                entity.Magazines.Remove(magazine);
                entity.MagazinesContent.Remove(magazineContent);
                entity.SaveChanges();
                Session["status"] = "deleted";
                return(RedirectToAction("Index"));
            }
            else
            {
                Session["status"] = "itemNotFound";
            }

            return(RedirectToAction("Index"));
        }
Example #30
0
        // GET: MagazineCategory/Delete/5
        public ActionResult Delete(int id)
        {
            BlueprintMediaServisEntity entity = new BlueprintMediaServisEntity();
            MagazineCategory           magazineCategoryEntity = entity.MagazineCategory.Find(id);

            if (magazineCategoryEntity != null)
            {
                if (magazineCategoryEntity.MagazinesContent.Count == 0)
                {
                    entity.MagazineCategory.Remove(magazineCategoryEntity);
                    entity.SaveChanges();
                    Session["status"] = "deleted";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    Session["status"] = "relatedEntity";
                    return(RedirectToAction("Index"));
                }
            }
            Session["status"] = "itemNotFound";
            return(RedirectToAction("Index"));
        }