public ActionResult Create([Bind(Include = "CompanyGUID,CompanyID,Name,Email,Password,PhoneNumber,Location,CoreBusiness,Image,Link")] Company company)
        {
            if (ModelState.IsValid)
            {
                db.Company.Add(company);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(company));
        }
        public ActionResult Create([Bind(Include = "ProgramadorGUID,ProgramadorID,FirstName,LastName,Email,Password,Age,PhoneNumber,Location,Category,Description,PriceHour,Foto,LinkGithub,LinkLinkedin,Certificates,Privacy")] Programador programador)
        {
            if (ModelState.IsValid)
            {
                db.Programador.Add(programador);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(programador));
        }
Exemple #3
0
        public ActionResult Create([Bind(Include = "LanguageID,Name,Image")] Language language)
        {
            if (ModelState.IsValid)
            {
                db.Language.Add(language);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(language));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "CompanyOfferID,CompanyID,LanguageID,Price,Location,Experience,Description")] CompanyOffer companyOffer)
        {
            var userId  = User.Identity.GetUserId();
            var company = db.Company.FirstOrDefault(p => p.CompanyGUID == userId);

            if (company == null)
            {
                return(HttpNotFound());
            }
            companyOffer.CompanyID = company.CompanyID;
            if (ModelState.IsValid)
            {
                db.CompanyOffer.Add(companyOffer);
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.CompanyID  = new SelectList(db.Company, "CompanyID", "CompanyGUID", companyOffer.CompanyID);
            ViewBag.LanguageID = new SelectList(db.Language, "LanguageID", "Name", companyOffer.LanguageID);
            return(View(companyOffer));
        }
        public async Task <ActionResult> RegisterCompany(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };

                var result = await UserManager.CreateAsync(user, model.Password);

                jobEntities1 db          = new jobEntities1();
                Company      userEmpresa = new Company
                {
                    CompanyGUID = user.Id,
                    Email       = user.Email
                };
                db.Company.Add(userEmpresa);
                db.SaveChanges();
                if (result.Succeeded)
                {
                    //Assign Role to user Here
                    await this.UserManager.AddToRoleAsync(user.Id, "Company");

                    //Ends Here
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    //Company NewCompanyUser = new Company();
                    //NewCompanyUser.CompanyGUID = user.Id;



                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Enviar um email com este link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirmar sua conta", "Confirme sua conta clicando <a href=\"" + callbackUrl + "\">aqui</a>");

                    return(RedirectToAction("Edit", "Companies", new { id = userEmpresa.CompanyID }));
                }
                AddErrors(result);
            }

            // Se chegamos até aqui e houver alguma falha, exiba novamente o formulário
            return(View(model));
        }