Esempio n. 1
0
        public ActionResult PostStatus(UserStatusViewModel collection, int?catchId)
        {
            string             status    = collection.myFeed.statusText.ToString();
            HttpPostedFileBase file      = collection.myPic;
            string             directory = @"~/Content/Images/";
            string             path      = null;
            string             fileName  = null;

            if (file != null && file.ContentLength > 0)
            {
                WebImage img = new WebImage(file.InputStream);
                if (img.Width > 300)
                {
                    img.Resize(300, 300);
                }
                fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(file.FileName);
                path     = Path.Combine(Server.MapPath(directory), fileName);
                img.Save(path);
            }

            var userId = User.Identity.GetUserId();

            var myStatusRepo = new StatusRepository();
            var isPublic     = true;

            myStatusRepo.StatusToDB(status, userId, fileName, isPublic, catchId);

            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Delete(string id)
        {
            UserStatusViewModel userStatusVM = new UserStatusViewModel();

            userStatusVM.DeleteUserStatusDetailsById(id);
            return(Redirect("~/UserStatus/Index"));
        }
        public ActionResult Details(string id)
        {
            UserStatusViewModel candidateVM = new UserStatusViewModel();
            UserStatusDTO       userStatus  = candidateVM.GetUserStatusDetailsById(id);

            return(View(userStatus));
        }
        public ActionResult Edit(string id)
        {
            UserStatusViewModel userStatus = new UserStatusViewModel();
            UserStatusDTO       status     = userStatus.GetUserStatusDetailsById(id);

            return(View(status));
        }
Esempio n. 5
0
        public IActionResult AdminPanel()
        {
            var totalUsersCount = this.userServices.GetAllUsers().Count();

            var adminsCount   = this.adminServices.GetAllAdmins().Count();
            var bannedCount   = this.adminServices.GetAllBannedUsers().Count();
            var ordinaryCount = this.adminServices.GetAllOrinaryUsers().Count();

            var usersStatus = new UserStatusViewModel()
            {
                Count         = totalUsersCount,
                AdminsCount   = adminsCount,
                BannedCount   = bannedCount,
                OrdinaryCount = ordinaryCount
            };

            var carsCount = this.carServices.GetAllCars().Count();

            var carsStatus = new CarStatusViewModel()
            {
                Count         = carsCount,
                InPrcessCount = carsCount,
                ReadyCount    = 0, // TODO
                WaitingCount  = 0  // TODO
            };


            var statusesViewModel = new StatusesViewModel()
            {
                UsersStatus = usersStatus,
                CarsStatus  = carsStatus
            };

            return(this.View(statusesViewModel));
        }
        public ActionResult Index()
        {
            // get all the list of candidates from the UserStatusViewModels and return the model to cshtml page

            UserStatusViewModel  userStatusVM = new UserStatusViewModel();
            List <UserStatusDTO> status       = userStatusVM.GetAllUserStatus();

            return(View(status));
        }
Esempio n. 7
0
        public ActionResult StatusWidget()
        {
            var user = _repository.All <User>().Single(x => x.OpenIdIdentifier == this.User.Identity.Name);

            var viewModel = new UserStatusViewModel();

            viewModel.DisplayName = user.DisplayName;
            viewModel.AvatarUrl   = _avatarGenerator.GenerateUrl(user.OpenIdIdentifier);

            return(PartialView(viewModel));
        }
Esempio n. 8
0
        public async Task <IActionResult> Resept(UserStatusViewModel model)
        {
            await db.Reseptions.AddAsync(new Reseption
            {
                DateTime = DateTime.Now,
                Name     = model.Comment,
                Phone    = model.Phone
            });

            await db.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 9
0
        public ActionResult UserStatus()
        {
            var viewModel = new UserStatusViewModel();

            if (Request.IsAuthenticated)
            {
                viewModel.IsAuthenticated = true;

                var adUserInfo = AdUserInfoService.GetAdUserInfo(User.Identity.Name);
                if (adUserInfo != null)
                {
                    viewModel.LoginName   = adUserInfo.LoginName;
                    viewModel.DisplayName = adUserInfo.FirstName;
                    viewModel.Thumbnail   = adUserInfo.Thumbnail;
                }
            }


            return(PartialView("_userStatus", viewModel));
        }
Esempio n. 10
0
        public ActionResult Index()
        {
            var myStatusRepo = new StatusRepository();

            var statusList = new List <Feed>();
            var userId     = User.Identity.GetUserId();
            var followList = new List <FollowList>();
            var catchList  = new List <CatchFeed>();

            statusList = myStatusRepo.ReturnFeedStatuses(userId);
            followList = myStatusRepo.ReturnFollowersList(userId);
            catchList  = myStatusRepo.ReturnCatch();

            UserStatusViewModel feedView = new UserStatusViewModel();

            feedView.myFeedList      = statusList;
            feedView.myFollowList    = followList;
            feedView.myCatchFeedList = catchList;

            return(View(feedView));
        }
Esempio n. 11
0
        public ActionResult PostCatch(UserStatusViewModel collection)
        {
            if (ModelState.IsValid)
            {
                int    zoneID = collection.myCatch.zoneID;
                int    baitID = collection.myCatch.baitTypeID;
                int    fishID = collection.myCatch.fishTypeId;
                double?length = collection.myCatch.length;
                double?weight = collection.myCatch.weight;

                var   myCatchRepo = new StatusRepository();
                Catch newCatch    = myCatchRepo.CatchToDB(zoneID, baitID, fishID, length, weight);

                var catchId = newCatch.ID;
                PostStatus(collection, catchId);
            }
            else
            {
                return(View("error"));
            }

            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 12
0
        public ActionResult UserStatus()
        {
            var viewModel = new UserStatusViewModel();

            if (Request.IsAuthenticated)
            {
                viewModel.IsAuthenticated = true;

                //TODO: Change in production

                //FAKE DATA
                var user = _userAccountService.GetUser(User.Identity.Name);
                if (user != null)
                {
                    viewModel.LoginName   = user.NombreUsuario;
                    viewModel.DisplayName = user.NombreMostrar;
                    viewModel.Email       = user.Email;
                    viewModel.Usuario     = user;
                }
            }


            return(PartialView("_userStatus", viewModel));
        }
Esempio n. 13
0
        public ActionResult PostStatus()
        {
            var viewModel = new UserStatusViewModel();

            return(View(viewModel));
        }
Esempio n. 14
0
 private async Task GetUserProfile()
 {
     var user = await _gr.GetUserInfo();
     currentlyReading = new ObservableCollection<UserStatusViewModel>();
     foreach (var status in user.User_statuses.User_status)
     {
         var book = new UserStatusViewModel(status);
         book.PostedUpdate += book_PostedUpdate;
         CurrentlyReading.Add(book);
     }
     NotifyPropertyChanged("CurrentlyReading");
 }
 //action
 public ActionResult Index() {
   var model = new UserStatusViewModel{ Title = "Index", IsLogged = TheUser.CheckStatus()};
   return View(model);
 }