示例#1
0
        public async Task <ActionResult> Create
            (CatererViewModel model)
        {
            if (ModelState.IsValid)
            {
                var newLocation = new GoogleMapDTO
                {
                    Address = model.Address,
                    Lat     = model.Lat,
                    Long    = model.Long
                };
                var userID =
                    _userManager.GetUserId(User);
                var newCaterer = new CatererDTO
                {
                    CatererID            = userID,
                    Address              = model.Address,
                    Lat                  = model.Lat,
                    Long                 = model.Long,
                    CateringFacilitiName = model.CateringFacilitiName,
                    CatererName          = model.CatererName
                };

                newLocation = await _GoogleMapSvc.Add(newLocation);

                var IDCateringFacility = await _CatererSvc.PostCaterer(newCaterer);


                List <Item> itemList = await _ExcelSvc.Get(model.FormDocument, IDCateringFacility);



                await _ItemSvc.PostItem(itemList);


                var QRImage = await _QRCodeSvc.GetQRImage(newLocation);



                return(File(QRImage.QRImageInBytes, System.Net.Mime.MediaTypeNames.Application.Octet, "MyQRCode.jpg"));
            }

            return(View("Index"));
        }
示例#2
0
        public IActionResult Create
            (GoogleMapsCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var newLocation = new GoogleMapDTO
                {
                    Address = model.Address,
                    Lat     = model.Lat,
                    Long    = model.Long
                };

                _GoogleMapSvc.Add(newLocation);


                return(RedirectToAction("Index",
                                        "GoogleMaps"));
            }

            return(View());
        }