Exemplo n.º 1
0
        public MockedEmployeeRepository()
        {
            var employee = new Employee();

            employee.CVUrl          = "mockedCVUrl";
            employee.ExperienceTime = 0.7;
            employee.User           = new User();
            employee.UserId         = "mockedUserId";

            var proffesion = new Proffesion();

            proffesion.Id    = "mockedId";
            proffesion.Title = "mockedTitle";

            var profession = new Proffesion {
                Id = "mockedId", Title = "mockedName"
            };

            employee.Proffesions = new List <Proffesion> {
                proffesion, proffesion, proffesion
            };

            Collection = new List <Employee> {
                employee, employee, employee
            };
        }
Exemplo n.º 2
0
 public void Update(Proffesion proffesion)
 {
     if (proffesion != null)
     {
         _applicationDbContext.Proffesions.Update(proffesion);
         _applicationDbContext.SaveChanges();
     }
 }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Proffesion proffesion = db.Proffesions.Find(id);

            db.Proffesions.Remove(proffesion);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public void TestGetCreate()
        {
            var entity = new Proffesion();

            entity.Id = "testId";

            _repository.Create(entity);

            Assert.Equal(entity, _repository.GetById("testId"));
        }
Exemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "ProffesionId,ProffesionName")] Proffesion proffesion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(proffesion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(proffesion));
 }
        public MockedProffesionRepository()
        {
            var profession = new Proffesion {
                Id = "mockedId", Title = "mockedName"
            };

            Collection = new List <Proffesion> {
                profession, profession, profession
            };
        }
Exemplo n.º 7
0
        public ActionResult Create([Bind(Include = "ProffesionId,ProffesionName")] Proffesion proffesion)
        {
            if (ModelState.IsValid)
            {
                db.Proffesions.Add(proffesion);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(proffesion));
        }
Exemplo n.º 8
0
        public void TestDelete()
        {
            var entity = new Proffesion();

            entity.Id = "testId";

            _repository.Create(entity);

            _repository.Delete(entity.Id);

            Assert.Null(_repository.GetById(entity.Id));
        }
Exemplo n.º 9
0
        public override bool IsValid(object value)
        {
            Proffesion proffesion = value as Proffesion;
            bool       checkOK    = false;

            if (proffesion != null)
            {
                if (proffesion.Actor == true || proffesion.Director == true || proffesion.Scenario == true)
                {
                    checkOK = true;
                }
            }
            return(checkOK);
        }
Exemplo n.º 10
0
        // GET: Proffesions/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Proffesion proffesion = db.Proffesions.Find(id);

            if (proffesion == null)
            {
                return(HttpNotFound());
            }
            return(View(proffesion));
        }
Exemplo n.º 11
0
        public MockedWorkAreaRepository()
        {
            var workArea = new WorkArea();

            workArea.Id    = "mockedId";
            workArea.Title = "mockedTitle";

            var profession = new Proffesion {
                Id = "mockedId", Title = "mockedName"
            };

            workArea.Proffesions = new List <Proffesion> {
                profession, profession, profession
            };

            Collection = new List <WorkArea> {
                workArea, workArea, workArea
            };
        }
Exemplo n.º 12
0
        // GET: People
        public ActionResult Index(string sortParam, string sortOrder, string proffesion, int?pageSize, int?page)
        {
            IEnumerable <People> peoples = db.Peoples.Include(p => p.Proffesion).Include(p => p.UserRates).ToList();

            ViewBag.SortParam  = new SelectList(new[] { "Nazwisko", "Imię", "Data urodzenia", "Oceny" }, sortParam);
            ViewBag.SortOrder  = new SelectList(SortOrder(), sortOrder);
            ViewBag.Proffesion = new SelectList(Proffesion.GetProffesions(), proffesion);
            ViewBag.PageSize   = new SelectList(PageSizes(), pageSize);
            ViewBag.NoContent  = "Brak postaci kina spełniających warunek :(";

            int pagesize   = (pageSize ?? DefPageSize);
            int pageNumber = (page ?? DefPageNo);

            peoples = SwitchProffesion(peoples, proffesion);
            peoples = SortPeoples(peoples, sortParam, sortOrder);

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_TileList", peoples.ToPagedList(pageNumber, pagesize)));
            }

            return(View(peoples.ToPagedList(pageNumber, pagesize)));
        }
Exemplo n.º 13
0
 public IActionResult AddProffesion(Proffesion proffesion)
 {
     _proffesionService.CreateItem(proffesion);
     return(RedirectToAction("Index", "Home"));
 }
Exemplo n.º 14
0
 public void CreateItem(Proffesion proffesion)
 {
     _proffesionRepository.Create(proffesion);
 }
Exemplo n.º 15
0
 public void Create(Proffesion proffesion)
 {
     _applicationDbContext.Proffesions.Add(proffesion);
     _applicationDbContext.SaveChanges();
 }
Exemplo n.º 16
0
 public void UpdateItem(Proffesion proffesion)
 {
     _proffesionRepository.Update(proffesion);
 }
Exemplo n.º 17
0
        /* TODO */
        public ActionResult Index(string id, string rate, string genre, string proffesion, int?pageSize, int?page)
        {
            CheckID(id);

            var UserID = User.Identity.GetUserId();

            ViewBag.ID         = id;
            ViewBag.UserID     = UserID;
            ViewBag.PageSize   = new SelectList(PageSizes(), pageSize);
            ViewBag.Genre      = new SelectList(MovieGenre.GetTypes(), genre);
            ViewBag.Proffesion = new SelectList(Proffesion.GetProffesions(), proffesion);
            ViewBag.Rate       = new SelectList(UserRate.GetRateRange(), rate);

            ViewBag.ProfileInfoes = true;
            ViewBag.RatesCount    = new int[UserRate.GetRateRange().Count()];

            int pagesize   = (pageSize ?? DefPageSize);
            int pageNumber = (page ?? DefPageNo);

            if (id == "Movies")
            {
                ViewBag.NoContent  = "Brak filmów spełniających warunek :(";
                ViewBag.Controller = "Movies";

                IEnumerable <Movie> movies = db.Movies.Include(m => m.Genre).Include(m => m.UserRates).Where(m => m.UserRates.Any(ur => ur.UserID == UserID)).ToList();
                ViewBag.Count = movies.Count();

                for (int i = 0; i < UserRate.GetRateRange().Count(); i++)
                {
                    ViewBag.RatesCount[i] = movies.Where(t => t.UserRates.Any(ur => ur.Rate == i + 1 && ur.UserID == ViewBag.UserID)).Count();
                }

                movies = SwitchGenre(movies, genre);
                movies = FilterRate(movies, rate, UserID);

                if (Request.IsAjaxRequest())
                {
                    return(PartialView("_TileList", movies.ToPagedList(pageNumber, pagesize)));
                }

                return(View(movies.ToPagedList(pageNumber, pagesize)));
            }
            else if (id == "People")
            {
                ViewBag.NoContent  = "Brak postaci kina spełniających warunek :(";
                ViewBag.Controller = "People";

                IEnumerable <People> peoples = db.Peoples.Include(p => p.Proffesion).Include(p => p.UserRates).Where(p => p.UserRates.Any(ur => ur.UserID == UserID)).ToList();
                ViewBag.Count = peoples.Count();

                for (int i = 0; i < UserRate.GetRateRange().Count(); i++)
                {
                    ViewBag.RatesCount[i] = peoples.Where(t => t.UserRates.Any(ur => ur.Rate == i + 1 && ur.UserID == ViewBag.UserID)).Count();
                }

                peoples = SwitchProffesion(peoples, proffesion);
                peoples = FilterRate(peoples, rate, UserID);

                if (Request.IsAjaxRequest())
                {
                    return(PartialView("_TileList", peoples.ToPagedList(pageNumber, pagesize)));
                }

                return(View(peoples.ToPagedList(pageNumber, pagesize)));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
 public void Create(Proffesion proffesion)
 {
     Collection.Add(proffesion);
 }
        public void Update(Proffesion proffesion)
        {
            var index = Collection.FindIndex(e => e.Id == proffesion.Id);

            Collection[index] = proffesion;
        }