Example #1
0
        public async Task <IActionResult> AddPickItem(UserIndexLayoutVM pick)
        {
            pick.MyItems.NewPick.SalesItem = false;

            if (!ModelState.IsValid)
            {
                return(RedirectToAction(nameof(Index), pick));
            }

            if (pick.Cordinates != null)
            {
                var cord = pick.Cordinates;
                cord = cord.Replace('(', ' ');
                cord = cord.Replace(')', ' ');

                string[] cordArr = cord.Split(',');
                pick.MyItems.NewPick.Latitude  = cordArr[0];
                pick.MyItems.NewPick.Longitude = cordArr[1];
            }
            else
            {
                pick.MyItems.NewPick.Latitude  = "59.36135710000001";
                pick.MyItems.NewPick.Longitude = "17.996267699999976";
            }

            if (!(await accountRepos.AddPick(pick.MyItems.NewPick)))
            {
                string msg = "Error!, we couldn't add your item.";

                return(RedirectToAction(nameof(Error), "User", msg));
            }

            return(RedirectToAction(nameof(Index)));
        }
Example #2
0
        internal async Task <UserIndexLayoutVM> GetUserIndexLayoutVM()
        {
            UserIndexLayoutVM userIndexLayout = new UserIndexLayoutVM();

            var ltMarketItems = await GetUserMarketItems();

            var myPicks = await GetUserPicks();

            userIndexLayout.LatestMarketItems = ltMarketItems;
            userIndexLayout.Picks             = myPicks;

            return(userIndexLayout);
        }
Example #3
0
        public async Task <IActionResult> AddMarketItem(UserIndexLayoutVM pick)
        {
            pick.MyItems.NewPick.SalesItem = true;

            if (!ModelState.IsValid)
            {
                return(RedirectToAction(nameof(Index), pick));
            }

            if (!(await accountRepos.AddPick(pick.MyItems.NewPick)))
            {
                string msg = "Error!, we couldn't add your item.";

                return(RedirectToAction(nameof(Error), "User", msg));
            }

            return(RedirectToAction(nameof(Index)));
        }