public void AddTouristSpotToCategory(string categoryName, int touristSpotId)
 {
     try
     {
         Category            category            = ValidateExistingCategory(categoryName);
         TouristSpot         touristSpot         = ValidateExistingTouristSpot(touristSpotId);
         TouristSpotCategory touristSpotCategory = new TouristSpotCategory
         {
             TouristSpot   = touristSpot,
             TouristSpotId = touristSpot.Id,
             Category      = category,
             CategoryId    = category.Id
         };
         this.categoryRepository.Add(category, touristSpotCategory);
         this.touristSpotRepository.Add(touristSpot, touristSpotCategory);
         this.touristSpotCategoryRepository.Add(category, touristSpot);
     }
     catch (ObjectNotFoundInDatabaseException)
     {
         throw new ObjectNotFoundInDatabaseException();
     }
     catch (RepeatedObjectException)
     {
         throw new RepeatedObjectException();
     }
 }
示例#2
0
        public void TestPutNotFoundObject()
        {
            TouristSpot touristSpotToUpdate = new TouristSpot()
            {
                Name = "Virgen del verdún",
                Id   = 3
            };
            TouristSpot newData = new TouristSpot()
            {
                Name = "The Green Roofs",
            };
            TouristSpotModelIn touristSpotModelToUpdate = new TouristSpotModelIn(touristSpotToUpdate);
            TouristSpotModelIn newDataModel             = new TouristSpotModelIn(newData);
            var mock = new Mock <ITouristSpotLogic>(MockBehavior.Strict);

            mock.Setup(ts => ts.Update(touristSpotModelToUpdate.Id, newData));
            mock.Setup(ts => ts.Get(touristSpotToUpdate.Id)).Throws(new ObjectNotFoundInDatabaseException());
            var controller = new TouristSpotController(mock.Object);

            var result         = controller.Put(touristSpotModelToUpdate.Id, newDataModel) as NotFoundObjectResult;
            var expectedResult = new NotFoundObjectResult("There is no tourist spot with such id.");

            mock.VerifyAll();
            Assert.AreEqual(expectedResult.Value, result.Value);
        }
        public void TestInitialize()
        {
            var touristSpot = new TouristSpot()
            {
                Id                    = 1,
                Name                  = "name",
                Description           = "description",
                Image                 = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 },
                Region                = null,
                TouristSpotCategories = new List <TouristSpotCategory>()
            };

            Lodging = new Lodging()
            {
                Id          = 1,
                Name        = "Name",
                Description = "Description",
                Rating      = 3,
                IsFull      = true,
                Images      = new List <LodgingImage>()
                {
                    new LodgingImage()
                },
                PricePerNight       = 100,
                Address             = "Valid Address 123",
                Phone               = "+598 98 303 040",
                ConfirmationMessage = "Your reservation has been confirmed!",
                TouristSpot         = touristSpot,
                IsDeleted           = false
            };
        }
        public void TestInitialize()
        {
            var touristSpot = new TouristSpot
            {
                Id                    = 1,
                Name                  = "name",
                Description           = "description",
                Image                 = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 },
                Region                = null,
                TouristSpotCategories = new List <TouristSpotCategory>()
            };

            var lodging = new Lodging
            {
                Id                  = 1,
                Name                = "Name",
                Description         = "Description",
                Rating              = 3,
                IsFull              = true,
                PricePerNight       = 100,
                Address             = "Valid Address 123",
                Phone               = "+598 98 303 040",
                ConfirmationMessage = "Your reservation has been confirmed!",
                TouristSpot         = touristSpot
            };

            LodgingImage = new LodgingImage
            {
                Id        = 1,
                LodgingId = lodging.Id,
                Lodging   = lodging,
                ImageData = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }
            };
            LodgingImageBasicInfoModel = new LodgingImageBasicInfoModel(LodgingImage);
        }
示例#5
0
        public void TestInitialize()
        {
            TouristSpotCategory = new TouristSpotCategory();

            var category = new Category()
            {
                Id   = 1,
                Name = "category 1"
            };

            Category = category;

            var region = new Region()
            {
                Id   = 1,
                Name = "region 1"
            };

            TouristSpot = new TouristSpot()
            {
                Id                    = 1,
                Name                  = "name",
                Description           = "description",
                Image                 = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 },
                Region                = region,
                TouristSpotCategories = new List <TouristSpotCategory>()
            };

            TouristSpot.TouristSpotCategories.Add(TouristSpotCategory);
        }
        public void UpdateValidTouristSpot()
        {
            TouristSpot touristSpotToUpdate = new TouristSpot()
            {
                Id               = touristSpot2.Id,
                Name             = "Colonia",
                Description      = "Para tomarte un relax con tu pareja y descansar.",
                Region           = region1,
                ListOfCategories = new List <CategoryTouristSpot>()
                {
                    categoryTouristSpot1
                },
                Image = picture
            };

            var touristSpotRepositoryMock = new Mock <ITouristSpotRepository>(MockBehavior.Strict);

            touristSpotRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(touristSpot2);
            touristSpotRepositoryMock.Setup(m => m.Update(It.IsAny <TouristSpot>()));

            var touristSpotLogic = new TouristSpotManagement(touristSpotRepositoryMock.Object);

            var resultOfUpdate = touristSpotLogic.UpdateTouristSpot(touristSpotToUpdate);

            touristSpotRepositoryMock.VerifyAll();
            Assert.IsTrue(resultOfUpdate.Name.Equals("Colonia"));
        }
        public void TestInitialize()
        {
            var category = new Category()
            {
                Id   = 1,
                Name = "category 1"
            };


            var tcs = new List <TouristSpotCategory>()
            {
                new TouristSpotCategory()
                {
                    CategoryId = category.Id, Category = category
                }
            };

            TouristSpot = new TouristSpot()
            {
                Id                    = 1,
                Name                  = "name",
                Description           = "description",
                Image                 = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 },
                RegionId              = 1,
                TouristSpotCategories = tcs
            };
            TouristSpotDetailedInfoModel = new TouristSpotDetailedInfoModel(TouristSpot);
        }
示例#8
0
 public TouristSpotModelOut(TouristSpot touristSpot)
 {
     this.Description = touristSpot.Description;
     this.Name        = touristSpot.Name;
     this.Image       = touristSpot.Image;
     this.Id          = touristSpot.Id;
 }
        //Create a method for retrieving data
        public List <TouristSpot> GetAllTouristSpot()
        {
            SqlConnection con = new SqlConnection(connectionString);

            string     query = "SELECT * FROM TouristSpot";
            SqlCommand cmd   = new SqlCommand(query, con);

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            List <TouristSpot> touristSpots = new List <TouristSpot>();

            while (reader.Read())
            {
                TouristSpot touristSpot = new TouristSpot();
                touristSpot.TouristSpotId   = (int)reader["TouristSpotId"];
                touristSpot.TouristSpotName = reader["TouristSpotName"].ToString();
                touristSpot.Communication   = reader["Communication"].ToString();

                touristSpots.Add(touristSpot);
            }
            reader.Close();
            con.Close();
            return(touristSpots);
        }
示例#10
0
        public void SetUp()
        {
            aRegion = new Region()
            {
                Id   = Guid.NewGuid(),
                Name = Region.RegionName.Región_Este
            };

            aTouristSpot = new TouristSpot()
            {
                Id          = Guid.NewGuid(),
                Name        = "Piriapolis",
                Description = "Un lugar unico",
                Region      = aRegion
            };

            aCategory = new Category()
            {
                Id   = Guid.NewGuid(),
                Name = "Playa",
            };
            categoryTouristSpot = new CategoryTouristSpot()
            {
                Category   = aCategory,
                CategoryId = aCategory.Id,
            };
        }
示例#11
0
        public void TestInitialize()
        {
            var category = new Category()
            {
                Id   = 1,
                Name = "category 1"
            };
            var region = new Region()
            {
                Id   = 1,
                Name = "region 1"
            };
            var tcs = new List <TouristSpotCategory>()
            {
                new TouristSpotCategory()
                {
                    CategoryId = category.Id, Category = category
                }
            };

            TouristSpot = new TouristSpot()
            {
                Id                    = 1,
                Name                  = "name",
                Description           = "description",
                Image                 = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 },
                RegionId              = region.Id,
                Region                = region,
                TouristSpotCategories = tcs
            };
        }
示例#12
0
        public void TestGetTouristSpotsByCategoriesIdAndRegionIdBad()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            TouristSpot aTouristSpot2 = new TouristSpot()
            {
                Id               = Guid.NewGuid(),
                Name             = "La Paloma",
                Description      = "Un gran lugar",
                Region           = aRegion,
                ListOfCategories = new List <CategoryTouristSpot>()
                {
                }
            };

            categoryTouristSpot.TouristSpot   = aTouristSpot2;
            categoryTouristSpot.TouristSpotId = aTouristSpot2.Id;
            aTouristSpot2.ListOfCategories.Add(categoryTouristSpot);
            touristSpotRepo.Add(aTouristSpot2);
            List <TouristSpot> listToCompare = new List <TouristSpot>()
            {
                aTouristSpot2
            };
            List <Guid> listOfCategoriesIdToSearch = new List <Guid>()
            {
                categoryTouristSpot.CategoryId
            };

            List <TouristSpot> touristSpotsByRegionAndCategories = touristSpotRepo.GetTouristSpotsByCategoriesAndRegion(listOfCategoriesIdToSearch, Guid.NewGuid());
        }
示例#13
0
        public bool Import(string binaryPath, string filePath, string type)
        {
            try
            {
                IAccommodationImport     requestedImplementation = GetImplementation(binaryPath, type);
                AccommodationImportModel imported = requestedImplementation.CreateObjectModel(filePath);
                TouristSpotImportModel   tsm      = imported.TouristSpot;
                TouristSpot ts = tsm.ToEntity();
                if (regionLogic.Get(tsm.RegionName).Name == tsm.RegionName)
                {
                    if (!this.touristSpotLogic.AlreadyExistsByName(tsm.Name))
                    {
                        this.touristSpotLogic.Add(ts);
                        this.regionLogic.AddTouristSpotToRegion(tsm.RegionName, tsm.Name);
                    }
                }
                if (!this.accommodationLogic.AlreadyExistsByName(imported.Name) && this.touristSpotLogic.AlreadyExistsByName(tsm.Name))
                {
                    Accommodation acc = imported.ToEntity();
                    acc.TouristSpot = this.touristSpotLogic.GetByName(ts.Name);
                    this.accommodationLogic.Add(acc, this.touristSpotLogic.GetByName(ts.Name).Name);
                    return(true);
                }

                return(false);
            }
            catch (JsonReaderException)
            {
                throw new FileIsNotJsonException();
            }
        }
        public void SearchReturnsRepositoryValue()
        {
            var touristSpot = new TouristSpot {
                Id = 1, Name = "name", Description = "description"
            };

            TouristSpotRepositoryMock.Setup(m => m.GetFirst(It.IsAny <Expression <Func <TouristSpot, bool> > >(), ""))
            .Returns(touristSpot);
            TouristSpotRepositoryMock.Setup(m => m.HasAnyBooking(1)).Returns(true);

            var reportModel = new ReportModel()
            {
                TouristSpot = touristSpot.Id,
                CheckIn     = DateTime.Now,
                CheckOut    = DateTime.Now.AddDays(5)
            };

            var reports = CreateLodgingsForTouristSpot(touristSpot).Select(l => new ReportBasicInfoModel(l)).ToList();

            LodgingRepositoryMock.Setup(m => m.Search(reportModel))
            .Returns(reports);

            var reportLogic = CreateReportLogic();

            Assert.IsTrue(reportLogic.Search(reportModel).SequenceEqual(reports));
        }
示例#15
0
        public void Add(Category category, TouristSpot touristSpot)
        {
            bool valid = true;
            IList <TouristSpotCategory> list = this.touristSpotCategories.ToList <TouristSpotCategory>();

            foreach (var item in list)
            {
                if (category.Id == item.CategoryId && touristSpot.Id == item.TouristSpotId)
                {
                    valid = false;
                }
            }
            if (valid)
            {
                TouristSpotCategory ts = new TouristSpotCategory
                {
                    Category      = category,
                    CategoryId    = category.Id,
                    TouristSpot   = touristSpot,
                    TouristSpotId = touristSpot.Id
                };
                this.touristSpotCategories.Add(ts);
                this.myContext.SaveChanges();
            }
        }
示例#16
0
        public void TestPutSuccessful()
        {
            TouristSpot touristSpotToUpdate = new TouristSpot()
            {
                Name = "Virgen del verdún",
                Id   = 3
            };
            TouristSpot newData = new TouristSpot()
            {
                Name = "The Green Roofs",
            };
            TouristSpotModelIn touristSpotModelToUpdate = new TouristSpotModelIn(touristSpotToUpdate);
            TouristSpotModelIn newDataModel             = new TouristSpotModelIn(newData);
            var mock = new Mock <ITouristSpotLogic>(MockBehavior.Strict);

            mock.Setup(ts => ts.Update(touristSpotModelToUpdate.Id, newData));
            mock.Setup(ts => ts.Get(touristSpotToUpdate.Id)).Returns(touristSpotToUpdate);
            var controller = new TouristSpotController(mock.Object);

            var result         = controller.Put(touristSpotModelToUpdate.Id, newDataModel) as OkObjectResult;
            var expectedResult = new OkObjectResult(new TouristSpotModelOut(touristSpotToUpdate));

            mock.VerifyAll();
            Assert.AreEqual(expectedResult.Value, result.Value);
        }
        public ActionResult Image(FormCollection fc, HttpPostedFileBase file)
        {
            int         id = Convert.ToInt32(Request.Form["rid"]);
            TouristSpot r  = db.TouristSpots.Find(id);

            ViewBag.rname = r.Name;
            ViewBag.rid   = r.Id;

            ViewBag.ImgList = db.ToristspotImages.Where(x => x.Touristspotid == r.Id).ToList();



            ToristspotImage Toristspot = new ToristspotImage();

            int    count = 2;
            string pt    = Path.GetFileNameWithoutExtension(file.FileName);
            string ex    = Path.GetExtension(file.FileName);
            string xx    = pt + ex;

            //  string FleName = pt + "." + ex;
            // var z = db.tblImgs.Where(x => x.imgUrl == pt + "%**%"+ ex).ToList();

            //Check If file exist or not
            if (System.IO.File.Exists(@"E:\KarnalTravel\KarnalTravel\Uploading\" + pt + ex))
            {
                int  ii = 2;
                bool x  = true;
                while (x)
                {
                    string fn = pt + "(" + ii + ")";
                    if (System.IO.File.Exists(@"E:\KarnalTravel\KarnalTravel\Uploading\" + fn + ex))
                    {
                        ii++;
                    }
                    else
                    {
                        x                 = false;
                        pt                = fn;
                        count             = ii;
                        Toristspot.imgurl = fn + ex;
                    }
                }
                string pathRename = Path.Combine("~/Uploading/" + pt + ex);
                Toristspot.imgurl = pt + ex;
                file.SaveAs(Server.MapPath(pathRename));
            }
            else
            {
                file.SaveAs(@"E:\KarnalTravel\KarnalTravel\Uploading\" + pt + ex);
                Toristspot.imgurl = pt + ex;
            }
            //-------------

            Toristspot.Touristspotid = Convert.ToInt32(Request.Form["rid"]);

            db.ToristspotImages.Add(Toristspot);
            db.SaveChanges();
            return(RedirectToAction("Image", new { id = Toristspot.Touristspotid }));
        }
        public void SetUp()
        {
            regionForTouristSpot = new Region()
            {
                Id   = Guid.NewGuid(),
                Name = Region.RegionName.Región_Centro_Sur
            };

            category = new Category()
            {
                Id   = Guid.NewGuid(),
                Name = "Playa"
            };

            touristSpotAdded = new TouristSpot()
            {
                Id               = Guid.NewGuid(),
                Name             = "Punta del Este",
                Description      = "Un lugar increible",
                Region           = regionForTouristSpot,
                ListOfCategories = new List <CategoryTouristSpot>()
                {
                    new CategoryTouristSpot()
                    {
                        Category = category
                    }
                },
                Image = new Picture()
                {
                    Path = "Desktop/joaco.jpg"
                }
            };

            touristSpotRequestModel = new TouristSpotForRequestModel()
            {
                Id                 = touristSpotAdded.Id,
                Name               = "Punta del Este",
                Description        = "Un lugar increible",
                RegionId           = regionForTouristSpot.Id,
                ListOfCategoriesId = new List <Guid>()
                {
                    category.Id
                },
                ImagePath = "Desktop/joaco.jpg"
            };

            touristSpotResponseModel = new TouristSpotForResponseModel
            {
                Id                    = touristSpotAdded.Id,
                Name                  = "Punta del Este",
                Description           = "Un lugar increible",
                RegionModel           = RegionForResponseModel.ToModel(regionForTouristSpot),
                ListOfCategoriesModel = new List <CategoryModel>()
                {
                    CategoryModel.ToModel(category)
                },
                ImagePath = "Desktop/joaco.jpg"
            };
        }
        public ActionResult DeleteConfirmed(string id)
        {
            TouristSpot touristSpot = db.TouristSpots.Find(id);

            db.TouristSpots.Remove(touristSpot);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#20
0
        public void SetUp()
        {
            regionForTouristSpot = new Region()
            {
                Id   = Guid.NewGuid(),
                Name = Region.RegionName.Región_Centro_Sur,
            };

            catogoryForTouristSpot = new Category()
            {
                Id   = Guid.NewGuid(),
                Name = "Playa"
            };

            touristSpotForLodging = new TouristSpot()
            {
                Id               = Guid.NewGuid(),
                Name             = "Punta del Este",
                Description      = "Un lugar increible",
                Region           = regionForTouristSpot,
                ListOfCategories = new List <CategoryTouristSpot>()
                {
                    new CategoryTouristSpot()
                    {
                        Category = catogoryForTouristSpot
                    }
                }
            };

            lodgingForReserve = new Lodging()
            {
                Id              = Guid.NewGuid(),
                Name            = "Hotel las cumbres",
                Address         = "En la punta de punta del este",
                QuantityOfStars = 5,
                PricePerNight   = 100,
                TouristSpot     = touristSpotForLodging
            };

            reserveOfLodging = new Reserve()
            {
                Id                   = Guid.NewGuid(),
                Name                 = "Joaquin",
                LastName             = "Lamela",
                Email                = "*****@*****.**",
                DescriptionForGuest  = "Se ha registrado correctamente la reserva",
                PhoneNumberOfContact = 29082733,
                CheckIn              = new DateTime(2020, 10, 05),
                CheckOut             = new DateTime(2020, 10, 07),
                QuantityOfAdult      = 1,
                QuantityOfBaby       = 1,
                QuantityOfChild      = 1,
                QuantityOfRetired    = 2,
                LodgingOfReserve     = lodgingForReserve,
                StateOfReserve       = Reserve.ReserveState.Creada,
                TotalPrice           = 660
            };
        }
 public TouristSpotBasicInfoModel(TouristSpot touristSpot)
 {
     Id         = touristSpot.Id;
     Name       = touristSpot.Name;
     Categories = new List <CategoryBasicInfoModel>();
     ImageData  = touristSpot.Image;
     Categories =
         touristSpot.TouristSpotCategories.Select(tsc => new CategoryBasicInfoModel(tsc.Category)).ToList();
 }
        public void SetUp()
        {
            touristSpot = new TouristSpot
            {
                Id          = Guid.NewGuid(),
                Name        = "Maldonado",
                Description = "Departamento donde la naturaleza y la tranquilidad desborda."
            };

            lodging = new Lodging()
            {
                Id              = Guid.NewGuid(),
                Name            = "Hotel Las Cumbres",
                QuantityOfStars = 5,
                Address         = "Ruta 12 km 3.5",
                PricePerNight   = 150,
                TouristSpot     = touristSpot,
            };

            reserve = new Reserve()
            {
                CheckIn             = new DateTime(2020, 10, 28),
                CheckOut            = new DateTime(2020, 10, 28),
                DescriptionForGuest = "Bienvenido",
                Email                = "*****@*****.**",
                Id                   = Guid.NewGuid(),
                Name                 = "Agustin",
                LastName             = "Her",
                LodgingOfReserve     = lodging,
                PhoneNumberOfContact = 59866545,
                QuantityOfAdult      = 1,
                QuantityOfBaby       = 1,
                QuantityOfChild      = 1,
                QuantityOfRetired    = 2,
                StateOfReserve       = Reserve.ReserveState.Creada,
                TotalPrice           = 1230
            };

            review = new Review()
            {
                Id                    = Guid.NewGuid(),
                Description           = "Me gusto mucho la estadia",
                IdOfReserve           = reserve.Id,
                LastNameOfWhoComments = reserve.LastName,
                NameOfWhoComments     = reserve.Name,
                LodgingOfReview       = lodging,
                Score                 = 4
            };

            reviewForRequest = new ReviewModelForRequest()
            {
                Description           = "Me gusto mucho la estadia",
                IdOfReserveAssociated = reserve.Id,
                Score = 4
            };
        }
        private TouristSpot ValidateExistingTouristSpot(string touristSpotName)
        {
            TouristSpot touristSpot = this.touristSpotRepository.Get(touristSpotName);

            if (touristSpot is null)
            {
                throw new ObjectNotFoundInDatabaseException();
            }
            return(touristSpot);
        }
示例#24
0
        public void TestGetTouristSpotByNameOk()
        {
            ContextObl             context         = ContextFactory.GetMemoryContext(Guid.NewGuid().ToString());
            ITouristSpotRepository touristSpotRepo = new TouristSpotRepository(context);

            touristSpotRepo.Add(aTouristSpot);
            TouristSpot touristSpotResult = touristSpotRepo.GetTouristSpotByName(aTouristSpot.Name);

            Assert.AreEqual(aTouristSpot, touristSpotResult);
        }
        public void SetUp()
        {
            aCategory = new Category()
            {
                Id   = Guid.NewGuid(),
                Name = "Playa",
            };
            categoryTouristSpot = new CategoryTouristSpot()
            {
                Category   = aCategory,
                CategoryId = aCategory.Id,
            };

            picture = new Picture()
            {
                Id   = Guid.NewGuid(),
                Path = "Desktop/foto.jpg"
            };

            lodgingPicture = new LodgingPicture()
            {
                Picture   = picture,
                PictureId = picture.Id
            };

            touristSpot = new TouristSpot
            {
                Id               = Guid.NewGuid(),
                Name             = "Maldonado",
                Description      = "Departamento donde la naturaleza y la tranquilidad desborda.",
                ListOfCategories = new List <CategoryTouristSpot>()
                {
                    categoryTouristSpot
                },
                Image = picture
            };

            categoryTouristSpot.TouristSpot   = touristSpot;
            categoryTouristSpot.TouristSpotId = touristSpot.Id;

            lodging = new Lodging()
            {
                Id              = Guid.NewGuid(),
                Name            = "Hotel Las Cumbres",
                Description     = "Magnifico hospedaje",
                QuantityOfStars = 5,
                Address         = "Ruta 12 km 3.5",
                PricePerNight   = 150,
                TouristSpot     = touristSpot,
                Images          = new List <LodgingPicture>()
                {
                    lodgingPicture
                }
            };
        }
示例#26
0
 private bool AlreadyExistsByName(TouristSpot newEntity)
 {
     foreach (var ts in this.touristSpots)
     {
         if (ts.Name == newEntity.Name)
         {
             return(true);
         }
     }
     return(false);
 }
 public ActionResult Edit([Bind(Include = "TouristSpot_Id,TouristSpot_Name,TouristSpot_Limit,TouristSpot_Price,TouristSpot_Specific,TouristSpot_Status,Location_Id,TouristSpot_Create")] TouristSpot touristSpot)
 {
     if (ModelState.IsValid)
     {
         db.Entry(touristSpot).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Location_Id = new SelectList(db.Locations, "Location_Id", "Location_Name", touristSpot.Location_Id);
     return(View(touristSpot));
 }
        public TouristSpot ToEntity()
        {
            TouristSpot ret = new TouristSpot
            {
                Description = this.Description,
                Name        = this.Name,
                Image       = this.Image,
            };

            return(ret);
        }
示例#29
0
 public void TestInitialize()
 {
     TouristSpot = new TouristSpot()
     {
         Id          = 1,
         Name        = "name",
         Description = "description",
         Image       = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }
     };
     TouristSpotNoAssociationsModel = new TouristSpotNoAssociationsModel(TouristSpot);
 }
示例#30
0
 public void Update(int id, TouristSpot newEntity)
 {
     try
     {
         this.touristSpotRepository.Update(id, newEntity);
     }
     catch (Exception ex)
     {
         throw new ObjectNotFoundInDatabaseException();
     }
 }