Ejemplo n.º 1
0
        public ActionResult Edit(Company myCompany)
        {
            var postData = Request.Form;

            if (ModelState.IsValid)
            {
                CompanyManager.Edit(myCompany);
                ModelState.Clear();
                return RedirectToAction("Index");
            }
            else
            {
                ViewBag.ListOffres = OfferManager.getByIdCompany(myCompany.Id);

                return View(myCompany);
            }
        }
Ejemplo n.º 2
0
 public ActionResult Add(Company company)
 {
     using (var context = new ApplicationDbContext())
     {
         var userStore = new UserStore<ApplicationUser>(context);
         var userManager = new UserManager<ApplicationUser>(userStore);
         var user = userManager.FindById(User.Identity.GetUserId());
         company.UserId = user.Id;
     }
     if (ModelState.IsValid)
     {
         CompanyManager.Add(company);
         ModelState.Clear();
         return RedirectToAction("Index");
     }
     return View("../Company/Add", company);
 }
Ejemplo n.º 3
0
        public ActionResult Index()
        {
            Company myCompany = new Company();
            string email = null;

            using (var context = new ApplicationDbContext())
            {
                var userStore = new UserStore<ApplicationUser>(context);
                var userManager = new UserManager<ApplicationUser>(userStore);
                var user = userManager.FindById(User.Identity.GetUserId());

                myCompany = CompanyManager.GetByIdUser(user.Id);

                myCompany.UserId = user.Id;
                email = user.UserName;
            }
                ViewBag.EmailUser = email;

            ViewBag.ListOffres = OfferManager.getByIdCompany(myCompany.Id);

            return View(myCompany);
        }