Beispiel #1
0
        // GET: Leaders/Create
        public ActionResult Create()
        {
            var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault();

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.CountryId = new SelectList(
                CombosHelper.GetCountries(),
                "CountryId",
                "Name");

            ViewBag.CityId = new SelectList(
                CombosHelper.GetCities(),
                "CityId",
                "Name");

            ViewBag.CompanyId = new SelectList(
                CombosHelper.GetCompanies(),
                "CompanyId",
                "Name");

            ViewBag.DepartmentId = new SelectList(
                CombosHelper.GetDepartments(),
                "DepartmentId",
                "Name");


            ViewBag.CommuneId = new SelectList(
                CombosHelper.GetCommunes(),
                "CommuneId",
                "Name");

            ViewBag.AssociationId = new SelectList(
                CombosHelper.GetAssociations(),
                "AssociationId",
                "Name");

            ViewBag.WorkPlaceId = new SelectList(
                CombosHelper.GetWorkPlaces(),
                "WorkPlaceId",
                "Name");

            ViewBag.VotingPlaceId = new SelectList(
                CombosHelper.GetVotingPlaces(),
                "VotingPlaceId",
                "Name");

            ViewBag.userId = new SelectList(
                CombosHelper.GetTypeUserCoordinator(),
                "userId",
                "name");

            ViewBag.ReferId = new SelectList(
                CombosHelper.GetRefer(),
                "ReferId",
                "FullName");

            var leader = new Leader
            {
                CompanyId = user.CompanyId,
                Date      = DateTime.Now,
                DateBorn  = DateTime.Now,
            };

            return(View(leader));
        }