public static void insertUser(string email, string name, string password, string gender)
        {
            User users = UserFront.createUser(email, name, password, gender);

            db.Users.Add(users);
            db.SaveChanges();
        }
Esempio n. 2
0
        public IHttpActionResult PutUser(UserFront user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            AppUser        u1         = new AppUser();
            List <AppUser> listaUsera = (List <AppUser>)unitOfWork.Users.GetAll();

            foreach (var u in listaUsera)
            {
                if (u.Email == user.Email)
                {
                    u1 = u;
                    break;
                }
            }


            unitOfWork.Users.ApproveUser(u1.Id);
            unitOfWork.Complete();


            return(Ok());
        }
Esempio n. 3
0
        public ActionResult Index()
        {
            User user = (User)Session["user"];

            if (user != null)
            {
                UserFront front = dbm.GetUserFrontpageInfo(user);
                Session["user"] = front.User;
                return(View(front));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Esempio n. 4
0
        public UserFront GetUserFrontpageInfo(User user)
        {
            UserFront front = new UserFront();

            user = GetUserFull(user);

            if (user != null)
            {
                List <Machine> machines = db.Machines.Where(m => m.ServiceID == user.ServiceID).ToList();
                CheckMachinesInUse(machines);

                front.User             = user;
                front.Service          = db.WasherServices.FirstOrDefault(s => s.Id == user.ServiceID);
                front.Machines         = machines;
                front.Reservations     = GetReservations(user);
                front.DoneReservations = GetDoneReservations(user);
            }

            return(front);
        }