Ejemplo n.º 1
0
        public ActionResult ShowPictures(int TypeId, string objectType)
        {
            ObjectFactory factory   = new ObjectFactory(repository);
            IAddImage     editImage = factory.CreateObject(objectType);

            List <HolidayApp.Entities.Image> images = editImage.GetImages(TypeId);

            List <EditImageModel> list = new List <EditImageModel>();

            AddPictureType addpicture = (AddPictureType)Enum.Parse(typeof(AddPictureType), objectType);


            if (images != null)
            {
                foreach (var item in images)
                {
                    list.Add(new EditImageModel()
                    {
                        Id = item.ImageId, TypeId = TypeId, type = addpicture, imagePath = item.ImagePath
                    });
                }
            }


            return(View(list));
        }
Ejemplo n.º 2
0
        public ActionResult FileUpload(AddImagesModel model)
        {
            string text = "";

            if (model.file != null)
            {
                string path = System.IO.Path.Combine(
                    Server.MapPath("~/Images"), "");
                ObjectFactory factory  = new ObjectFactory(repository);
                IAddImage     addImage = factory.CreateObject(model.type.ToString());
                text = addImage.AddPathToEntity(model.Id, path);

                if (text == "")
                {
                    return(View("AddImagesToMany"));
                }


                model.file.SaveAs(path + text);
            }

            if (text.Contains("Hotel"))
            {
                return(RedirectToAction("EditHotel", new { id = text[6] }));
            }
            else
            {
                return(RedirectToAction("EditResort", new { id = text[7] }));
            }
        }
Ejemplo n.º 3
0
        public ActionResult EditPicture(int PictureId, int TypeId, string objectType)
        {
            ObjectFactory factory   = new ObjectFactory(repository);
            IAddImage     editImage = factory.CreateObject(objectType);

            HolidayApp.Entities.Image image = editImage.GetImageFromDb(PictureId, TypeId);



            return(View(image));
        }