// GET: TourDtoes
        public async Task <ActionResult> Index(int?tId, string recentAction, string recentNameT, string recentIdT, string recentNameA, string recentIdA)
        {
            if (tId.HasValue == false)
            {
                return(RedirectToAction("Index", "Tours"));
            }
            //Pass through most recent action details if redirected from an action
            if (recentAction != null && recentAction.Count() > 0)
            {
                ViewBag.Action      = recentAction;
                ViewBag.RecentNameT = recentNameT;
                ViewBag.RecentIdT   = recentIdT;
                ViewBag.RecentNameA = recentNameA;
                ViewBag.RecentIdA   = recentIdA;
            }
            var request = new HTTPrequest();

            ViewBag.tourId = tId;
            TourDto tour = await request.Get <TourDto>("api/tour/" + tId);

            ViewBag.tourName = tour.Name;
            List <TourArtefactDto> toursArtefactsMasterlist = await request.Get <List <TourArtefactDto> >("api/tourArtefact?pageNumber=0&numPerPage=999999&isDeleted=false");

            List <TourArtefactDto> tourArtefactsFiltered = toursArtefactsMasterlist.Where(m => m.Tour.Id.ToString() == tour.Id.ToString()).ToList();

            //viewModel = await request.Get<List<TourDto>>("api/tour?tourId=" + tourId + "&pageNumber=0&numPerPage=500&isDeleted=false");
            List <TourArtefactDto> tourArtefactList = tourArtefactsFiltered.OrderBy(m => m.Order).ToList();

            ViewBag.tourArtefactList = tourArtefactList;

            List <TourArtefactDto> viewModel = tourArtefactList;

            return(View(viewModel));
        }
        // GET: TourDtoes/Create
        public async Task <ActionResult> Create(int?tourId)
        {
            bool tour_Selected = tourId.HasValue;

            ViewBag.TourSelected = tour_Selected;
            var request = new HTTPrequest();


            List <TourSimpleDto>  toursList    = new List <TourSimpleDto>();
            TourSimpleDto         tour         = new TourSimpleDto();
            List <SelectListItem> tourDropdown = new List <SelectListItem>();

            // Checks if page was access from Index of all MediaFiles, or Direct from a particular artefact
            if (tour_Selected == true)
            {
                tour = await request.Get <TourSimpleDto>("api/tour/" + tourId);

                if (tour == null)
                {
                    return(HttpNotFound());
                }
                else
                {
                    tourDropdown.Add(new SelectListItem()
                    {
                        Text  = tour.Id + ": " + tour.Name,
                        Value = tour.Id.ToString()
                    });
                    ViewBag.TourName = tour.Name;
                    ViewBag.TourID   = tour.Id.ToString();
                }
            }
            else
            {
                toursList = await request.Get <List <TourSimpleDto> >("api/tour?pageNumber=0&numPerPage=5-0&isDeleted=false");

                if (toursList != null && toursList.Any())
                {
                    foreach (var tours in toursList)
                    {
                        tourDropdown.Add(new SelectListItem()
                        {
                            Text  = tours.Id + ": " + tours.Name,
                            Value = tours.Id.ToString()
                        });
                    }
                }
            }

            ViewBag.TourList = tourDropdown;
            //ARTEFACT DROPDOWN
            List <SelectListItem> artefactDropdown = new List <SelectListItem>();

            artefactDropdown = await PopulateArtefactDropdown();

            ViewBag.ArtefactList = artefactDropdown;
            return(View());
        }
        public async Task <ActionResult> Create(TourArtefactDto tourArtefact, int?tourId)
        {
            // Checks Order is not Negative or Empty
            if (tourArtefact.Order < 0 || tourArtefact.Order == null)
            {
                ViewBag.OrderValidation = "Order must be a positive integer.";
                return(View(tourArtefact));
            }
            bool tour_Selected = tourId.HasValue;
            //TOUR CATEGORY
            List <SelectListItem> tourDropdown = new List <SelectListItem>();

            if (tour_Selected)
            {
                tourDropdown = await PopulateTourDropdown(tour_Selected, tourId);
            }
            else
            {
                tourDropdown = await PopulateTourDropdown(tour_Selected, null);
            }
            ViewBag.TourList = tourDropdown;
            //ARTEFACT DROPDOWN
            List <SelectListItem> artefactDropdown = new List <SelectListItem>();

            artefactDropdown = await PopulateArtefactDropdown();

            ViewBag.ArtefactList = artefactDropdown;

            ViewBag.TourID = tourId.ToString();

            var     tourRequest = new HTTPrequest();
            TourDto tourCheck   = await tourRequest.Get <TourDto>("api/tour/" + tourArtefact.Tour.Id);

            TourArtefactDto newTourArtefact = new TourArtefactDto();

            if (tourCheck.Artefacts.Any(m => m.Order == tourArtefact.Order) && tourCheck.Artefacts.Any(m => m.Id == tourArtefact.Artefact.Id))
            {
                ViewBag.IndexAvail = false;
                return(View(newTourArtefact));
            }

            newTourArtefact.Artefact = await tourRequest.Get <ArtefactSimpleDto>("api/artefact/" + tourArtefact.Artefact.Id);

            TourSimpleDto tour = await tourRequest.Get <TourSimpleDto>("api/tour/" + tourArtefact.Tour.Id);

            newTourArtefact.Tour         = tour;
            newTourArtefact.Order        = tourArtefact.Order;
            newTourArtefact.CreatedDate  = DateTime.Now;
            newTourArtefact.ModifiedDate = DateTime.Now;
            var request = new HTTPrequest();
            await request.Post <TourArtefactDto>("api/tourArtefact", newTourArtefact);

            return(RedirectToAction("Index", "ToursArtefacts", new { tId = newTourArtefact.Tour.Id, recentAction = "Created", recentNameT = newTourArtefact.Tour.Name, recentIdT = newTourArtefact.Tour.Id, recentNameA = newTourArtefact.Artefact.Name, recentIdA = newTourArtefact.Artefact.Id }));
        }
        // GET: ArtefactInfo/Create
        public async Task <ActionResult> Create(int?artefactId)
        {
            bool artefact_Selected = artefactId.HasValue;

            ViewBag.ArteFactSelected = artefact_Selected;
            var request = new HTTPrequest();
            List <ArtefactSimpleDto> artefactsList    = new List <ArtefactSimpleDto>();
            ArtefactSimpleDto        artefact         = new ArtefactSimpleDto();
            List <SelectListItem>    artefactDropdown = new List <SelectListItem>();

            // Checks if page was access from Index of all MediaFiles, or Direct from a particular artefact
            if (artefact_Selected == true)
            {
                artefact = await request.Get <ArtefactSimpleDto>("api/artefact/" + artefactId);

                if (artefact == null)
                {
                    return(HttpNotFound());
                }
                else
                {
                    artefactDropdown.Add(new SelectListItem()
                    {
                        Text  = artefact.Id + ": " + artefact.Name,
                        Value = artefact.Id.ToString()
                    });
                    ViewBag.ArtefactName = artefact.Name;
                    ViewBag.ArtefactID   = artefact.Id.ToString();
                }
            }
            else
            {
                artefactsList = await request.Get <List <ArtefactSimpleDto> >("api/artefact?pageNumber=0&numPerPage=5-0&isDeleted=false");

                if (artefactsList != null && artefactsList.Any())
                {
                    foreach (var artefacts in artefactsList)
                    {
                        artefactDropdown.Add(new SelectListItem()
                        {
                            Text  = artefacts.Id + ": " + artefacts.Name,
                            Value = artefacts.Id.ToString()
                        });
                    }
                }
            }

            ViewBag.ArtefactList = artefactDropdown;
            return(View());
        }
        // GET: storeItemImage/Create
        public async Task <ActionResult> Create(int?storeItemId)
        {
            bool storeItem_Selected = storeItemId.HasValue;

            ViewBag.StoreItemSelected = storeItem_Selected;
            var request = new HTTPrequest();
            List <StoreItemSimpleDto> storeItemsList    = new List <StoreItemSimpleDto>();
            StoreItemSimpleDto        storeItem         = new StoreItemSimpleDto();
            List <SelectListItem>     storeItemDropdown = new List <SelectListItem>();

            // Checks if page was access from Index of all MediaFiles, or Direct from a particular storeItem
            if (storeItem_Selected == true)
            {
                storeItem = await request.Get <StoreItemSimpleDto>("api/storeItem/" + storeItemId);

                if (storeItem == null)
                {
                    return(HttpNotFound());
                }
                else
                {
                    storeItemDropdown.Add(new SelectListItem()
                    {
                        Text  = storeItem.Name,
                        Value = storeItem.Id.ToString()
                    });
                    ViewBag.StoreItemName = storeItem.Name;
                    ViewBag.StoreItemID   = storeItem.Id.ToString();
                }
            }
            else
            {
                storeItemsList = await request.Get <List <StoreItemSimpleDto> >("api/storeItem?pageNumber=0&numPerPage=5-0&isDeleted=false");

                if (storeItemsList != null && storeItemsList.Any())
                {
                    foreach (var storeItems in storeItemsList)
                    {
                        storeItemDropdown.Add(new SelectListItem()
                        {
                            Text  = storeItems.Id + ":" + storeItems.Name,
                            Value = storeItems.Id.ToString()
                        });
                    }
                }
            }

            ViewBag.StoreItemList = storeItemDropdown;
            return(View());
        }
        // GET: ArtefactInfo/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var request = new HTTPrequest();

            ArtefactInfoDto artefactInfo = await request.Get <ArtefactInfoDto>("api/artefactInfo/" + id);

            if (artefactInfo == null)
            {
                return(HttpNotFound());
            }

            //TODO review this works
            HttpResponseMessage bytesResponse = await request.GetResponseMessage("api/artefactInfo/" + id + "/bytes");

            byte[] response = await bytesResponse.Content.ReadAsByteArrayAsync();

            //sets bytes to actual byte response
            artefactInfo.File = response;

            return(View(artefactInfo));
        }
Exemplo n.º 7
0
        public async Task <ActionResult> Edit(StoreItemDto storeItem, HttpPostedFileBase imageFile)
        {
            // Checks Name is not Null or Empty
            if (string.IsNullOrEmpty(storeItem.Name))
            {
                ViewBag.ValidationName = "Name field is required.";
                return(View(storeItem));
            }
            var          request           = new HTTPrequest();
            StoreItemDto storeItem_editted = await request.Get <StoreItemDto>("api/storeItem/" + storeItem.Id);

            if (ModelState.IsValid)
            {
                storeItem_editted.Name         = storeItem.Name;
                storeItem_editted.Description  = storeItem.Description;
                storeItem_editted.ModifiedDate = storeItem.ModifiedDate;
                storeItem_editted.InStock      = storeItem.InStock;
                storeItem_editted.Cost         = storeItem.Cost;
                storeItem_editted.ModifiedDate = DateTime.Now;

                await request.Put <StoreItemDto>("api/storeItem", storeItem_editted);

                return(RedirectToAction("Index", new { recentAction = "Editted", recentName = storeItem.Name, recentId = storeItem.Id }));
            }
            return(View(storeItem));
        }
        // GET: Artefacts/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            var request = new HTTPrequest();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ArtefactDto artefact = await request.Get <ArtefactDto>("api/artefact/" + id);

            if (artefact == null)
            {
                return(HttpNotFound());
            }
            // ARTEFACT CATEGORY DROPDOWN
            List <SelectListItem> categoryDropdown = new List <SelectListItem>();

            categoryDropdown = await PopulateCategoryDropdown();

            ViewBag.CategoryList = categoryDropdown;

            // ARTEFACT ZONE DROPDOWN
            List <SelectListItem> zoneDropdown = new List <SelectListItem>();

            zoneDropdown = await PopulateZoneDropdownList();

            ViewBag.ZoneList = zoneDropdown;


            return(View(artefact));
        }
Exemplo n.º 9
0
        public async Task <List <SelectListItem> > PopulateBeaconDropdownList()
        {
            var request = new HTTPrequest();
            List <BeaconSimpleDto> museumBeacons = await request.Get <List <BeaconSimpleDto> >("api/beacon?pageNumber=0&numPerPage=5-0&isDeleted=false");

            List <SelectListItem> beaconDropdown = new List <SelectListItem>();

            beaconDropdown.Add(new SelectListItem()
            {
                Text  = "Select Beacon",
                Value = "0"
            });
            if (museumBeacons != null && museumBeacons.Any())
            {
                foreach (var beacon in museumBeacons)
                {
                    beaconDropdown.Add(new SelectListItem()
                    {
                        Text  = beacon.Id + ": " + beacon.Name,
                        Value = beacon.Id.ToString()
                    });
                }
            }
            return(beaconDropdown);
        }
Exemplo n.º 10
0
        public async Task <List <SelectListItem> > PopulateCategoryDropdown()
        {
            var request = new HTTPrequest();
            List <ArtefactCategorySimpleDto> artefactCateories = await request.Get <List <ArtefactCategorySimpleDto> >("api/artefactCatergory?pageNumber=0&numPerPage=5-0&isDeleted=false");

            List <SelectListItem> categoryDropdown = new List <SelectListItem>();

            categoryDropdown.Add(new SelectListItem()
            {
                Text  = "Select Category",
                Value = "0"
            });
            if (artefactCateories != null && artefactCateories.Any())
            {
                foreach (var category in artefactCateories)
                {
                    categoryDropdown.Add(new SelectListItem()
                    {
                        Text  = category.Id + ": " + category.Name,
                        Value = category.Id.ToString()
                    });
                }
            }
            return(categoryDropdown);
        }
Exemplo n.º 11
0
        public async Task <List <SelectListItem> > PopulateZoneDropdownList()
        {
            var request = new HTTPrequest();
            List <ZoneSimpleDto> museumZones = await request.Get <List <ZoneSimpleDto> >("api/zone?pageNumber=0&numPerPage=5-0&isDeleted=false");

            List <SelectListItem> zoneDropdown = new List <SelectListItem>();

            zoneDropdown.Add(new SelectListItem()
            {
                Text  = "Select Zone",
                Value = "0"
            });
            if (museumZones != null && museumZones.Any())
            {
                foreach (var zone in museumZones)
                {
                    zoneDropdown.Add(new SelectListItem()
                    {
                        Text  = zone.Id + ": " + zone.Name,
                        Value = zone.Id.ToString()
                    });
                }
            }
            return(zoneDropdown);
        }
Exemplo n.º 12
0
        // GET: ArtefactCategoryDtoes
        public async Task <ActionResult> Index(string sortOrder, string currentFilter, string searchString, int?page, string recentAction, string recentName, string recentId)
        {
            var request = new HTTPrequest();

            //Pass through most recent action details if redirected from an action
            if (recentAction != null && recentAction.Count() > 0)
            {
                ViewBag.Action     = recentAction;
                ViewBag.RecentName = recentName;
                ViewBag.RecentId   = recentId;
            }
            ViewBag.CurrentSort  = sortOrder;
            ViewBag.IdSortParm   = String.IsNullOrEmpty(sortOrder) ? "id_desc" : "";
            ViewBag.NameSortParm = sortOrder == "Name" ? "name_desc" : "Name";
            List <ArtefactCategoryDto> categoryMasterList = await request.Get <List <ArtefactCategoryDto> >("api/artefactCatergory?pageNumber=0&numPerPage=500&isDeleted=false");

            IEnumerable <ArtefactCategoryDto> categoriesFiltered = categoryMasterList.ToList();

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewBag.CurrentFilter = searchString;


            if (!String.IsNullOrEmpty(searchString))
            {
                categoriesFiltered = categoriesFiltered.Where(a => a.Name.Contains(searchString));
            }

            var categories = categoriesFiltered;

            switch (sortOrder)
            {
            case "id_desc":
                categories = categories.OrderByDescending(a => a.Id);
                break;

            case "Name":
                categories = categories.OrderBy(a => a.Name);
                break;

            case "name_desc":
                categories = categories.OrderByDescending(a => a.Name);
                break;

            default:
                categories = categories.OrderBy(a => a.Id);
                break;
            }

            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(View(categories.ToPagedList(pageNumber, pageSize)));
        }
Exemplo n.º 13
0
        public async Task <ActionResult> Edit(ArtefactCategoryDto category, HttpPostedFileBase imageFile)
        {
            var request = new HTTPrequest();
            ArtefactCategoryDto category_editted = await request.Get <ArtefactCategoryDto>("api/artefactCatergory/" + category.Id);

            if (ModelState.IsValid)
            {
                category_editted.Name         = category.Name;
                category_editted.Description  = category.Description;
                category_editted.ModifiedDate = DateTime.Now;
                HttpPostedFileBase imgFile = Request.Files["ImageFile"];

                if (imageFile != null)
                {
                    category_editted.Image = new byte[imageFile.ContentLength];
                    imageFile.InputStream.Read(category_editted.Image, 0, imageFile.ContentLength);
                }
                else
                {
                    category_editted.Image = category_editted.Image;
                }

                await request.Put <ArtefactCategoryDto>("api/artefactCatergory", category_editted);

                return(RedirectToAction("Index", new { recentAction = "Editted", recentName = category.Name, recentId = category.Id }));
            }
            return(View(category));
        }
        public async Task <ActionResult> Edit(ArtefactInfoDto artefactInfo, HttpPostedFileBase ArtefactInfoFile)
        {
            var             request = new HTTPrequest();
            ArtefactInfoDto artefactInfo_editted = await request.Get <ArtefactInfoDto>("api/artefactInfo/" + artefactInfo.Id.ToString());

            // Checks Name is not Null or Empty
            if (artefactInfo.Artefact.Id.ToString() == null || string.IsNullOrEmpty(artefactInfo.Artefact.Id.ToString()))
            {
                ViewBag.ValidationName = "Artefact is required.";
                return(View(artefactInfo));
            }

            if (ModelState.IsValid)
            {
                artefactInfo_editted.Artefact         = artefactInfo.Artefact;
                artefactInfo_editted.Content          = artefactInfo.Content;
                artefactInfo_editted.Description      = artefactInfo.Description;
                artefactInfo_editted.ArtefactInfoType = artefactInfo.ArtefactInfoType;
                if (ArtefactInfoFile != null)
                {
                    HttpPostedFileBase mediaFile = Request.Files["ArtefactInfoFile"];

                    artefactInfo_editted.File = new byte[mediaFile.ContentLength];
                    mediaFile.InputStream.Read(artefactInfo_editted.File, 0, mediaFile.ContentLength);
                    string fileExtension = Path.GetExtension(mediaFile.FileName);
                    artefactInfo_editted.FileExtension = fileExtension;
                }


                artefactInfo = await request.Put <ArtefactInfoDto>("api/artefactInfo", artefactInfo_editted);

                return(RedirectToAction("Index"));
            }
            return(View(artefactInfo));
        }
Exemplo n.º 15
0
        public async Task <List <StoreItemDto> > GetStoreItems()
        {
            var request = new HTTPrequest();
            List <StoreItemDto> storeItemsMasterList = await request.Get <List <StoreItemDto> >("api/storeItem?pageNumber=0&numPerPage=99999&isDeleted=false");

            return(storeItemsMasterList);
        }
Exemplo n.º 16
0
        public async Task <List <ArtefactDto> > GetArtefacts()
        {
            var request = new HTTPrequest();
            List <ArtefactDto> artefactMasterList = await request.Get <List <ArtefactDto> >("api/artefact?pageNumber=0&numPerPage=99999&isDeleted=false");

            return(artefactMasterList);
        }
Exemplo n.º 17
0
        public async Task <List <ExhibitionDto> > GetExhibitions()
        {
            var request = new HTTPrequest();
            List <ExhibitionDto> exhibitionsMasterList = await request.Get <List <ExhibitionDto> >("api/exhibition?pageNumber=0&numPerPage=99999&isDeleted=false");

            return(exhibitionsMasterList);
        }
Exemplo n.º 18
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            var     request = new HTTPrequest();
            TourDto tour    = await request.Get <TourDto>("api/tour/" + id);

            tour.IsDeleted = true;
            await request.Delete("api/tour/" + id.ToString());

            return(RedirectToAction("Index", new { recentAction = "Deleted", recentName = tour.Name, recentId = tour.Id }));
        }
Exemplo n.º 19
0
        public async Task <ActionResult> GetApiExample()
        {
            try
            {
                var request           = new HTTPrequest();
                List <ArtefactDto> vm = await request.Get <List <ArtefactDto> >("api/artefact?pageNumber=0&numPerPage=500&isDeleted=false");

                return(View(vm));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try {
                var         request  = new HTTPrequest();
                ArtefactDto artefact = await request.Get <ArtefactDto>("api/artefact/" + id);

                await request.Delete("api/artefact/" + id);

                return(RedirectToAction("Index", new { recentAction = "Deleted", recentName = artefact.Name, recentId = artefact.Id }));
            }
            catch (Exception) {
                throw;
            }
        }
Exemplo n.º 21
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try {
                var          request   = new HTTPrequest();
                StoreItemDto storeItem = await request.Get <StoreItemDto>("api/storeItem/" + id);

                await request.Delete("api/storeItem/" + id);

                return(RedirectToAction("Index", new { recentAction = "Deleted", recentName = storeItem.Name, recentId = storeItem.Id }));
            }
            catch (Exception) {
                throw;
            }
        }
        // GET: ArtefactInfo/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var             request      = new HTTPrequest();
            ArtefactInfoDto artefactInfo = await request.Get <ArtefactInfoDto>("api/artefactInfo/" + id);

            if (artefactInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(artefactInfo));
        }
Exemplo n.º 23
0
        // GET: Zones/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var     request = new HTTPrequest();
            ZoneDto zone    = await request.Get <ZoneDto>("api/zone/" + id);

            if (zone == null)
            {
                return(HttpNotFound());
            }
            return(View(zone));
        }
Exemplo n.º 24
0
        // GET: ArtefactCategoryDtoes/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var request = new HTTPrequest();
            ArtefactCategoryDto category = await request.Get <ArtefactCategoryDto>("api/artefactCatergory/" + id);

            if (category == null)
            {
                return(HttpNotFound());
            }
            return(View(category));
        }
        public async Task <List <SelectListItem> > PopulateTourDropdown(bool tourSelected, int?tourId)
        {
            var request = new HTTPrequest();
            List <TourSimpleDto> toursList = await request.Get <List <TourSimpleDto> >("api/tour?pageNumber=0&numPerPage=5-0&isDeleted=false");

            List <SelectListItem> tourDropdown = new List <SelectListItem>();
            TourSimpleDto         tour         = new TourSimpleDto();

            if (tourSelected == true)
            {
                tour = await request.Get <TourSimpleDto>("api/tour/" + tourId);

                if (tour != null)
                {
                    tourDropdown.Add(new SelectListItem()
                    {
                        Text  = tour.Id + ":" + tour.Name,
                        Value = tour.Id.ToString()
                    });
                    ViewBag.TourName = tour.Name;
                    ViewBag.TourID   = tour.Id.ToString();
                }
            }
            else
            {
                foreach (var t in toursList)
                {
                    tourDropdown.Add(new SelectListItem()
                    {
                        Text  = t.Id + ": " + t.Name,
                        Value = t.Id.ToString()
                    });
                }
            }
            return(tourDropdown);
        }
        // GET: TourDtoes/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var     request = new HTTPrequest();
            TourDto tour    = await request.Get <TourDto>("api/tour/" + id);

            if (tour == null)
            {
                return(HttpNotFound());
            }
            return(View(tour));
        }
Exemplo n.º 27
0
        // GET: Beacons/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var       request = new HTTPrequest();
            BeaconDto beacon  = await request.Get <BeaconDto>("api/beacon/" + id);

            if (beacon == null)
            {
                return(HttpNotFound());
            }
            return(View(beacon));
        }
        // GET: storeItemImage/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var request = new HTTPrequest();
            StoreItemImageDto storeItemImage = await request.Get <StoreItemImageDto>("api/storeItemImage/" + id);

            if (storeItemImage == null)
            {
                return(HttpNotFound());
            }
            return(View(storeItemImage));
        }
        // GET: Artefacts/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var           request    = new HTTPrequest();
            ExhibitionDto exhibition = await request.Get <ExhibitionDto>("api/exhibition/" + id);

            if (exhibition == null)
            {
                return(HttpNotFound());
            }
            return(View(exhibition));
        }
Exemplo n.º 30
0
        // GET: TourDtoes/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            var request = new HTTPrequest();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TourDto tour = await request.Get <TourDto>("api/tour/" + id);

            if (tour == null)
            {
                return(HttpNotFound());
            }
            List <ArtefactSimpleDto> artefactsList = new List <ArtefactSimpleDto>();
            ArtefactSimpleDto        artefact      = new ArtefactSimpleDto();

            List <SelectListItem> artefactDropdown = new List <SelectListItem>();

            artefactsList = await request.Get <List <ArtefactSimpleDto> >("api/artefact?pageNumber=0&numPerPage=5-0&isDeleted=false");

            if (artefactsList != null && artefactsList.Any())
            {
                foreach (var artefacts in artefactsList)
                {
                    artefactDropdown.Add(new SelectListItem()
                    {
                        Text  = artefacts.Id + ":" + artefacts.Name,
                        Value = artefacts.Id.ToString()
                    });
                }
            }

            ViewBag.ArtefactList = artefactDropdown;
            return(View(tour));
        }