public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                bool isPreRegistered = WorkersBL.IsWorkerPreRegistered(model.IdNumber);
                if (isPreRegistered)
                {
                    var user = new ApplicationUser {
                        UserName = model.Email, Email = model.Email
                    };
                    IdentityResult result = await UserManager.CreateAsync(user, model.Password);

                    if (result.Succeeded)
                    {
                        WorkersBL.SetWorkerRegistered(model.IdNumber);
                        await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                        // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                        // Send an email with this 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, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                        return(RedirectToAction("Index", "Home"));
                    }
                    AddErrors(result);
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
 public ActionResult Edit(Worker worker)
 {
     if (ModelState.IsValid)
     {
         WorkersBL.SaveWorker(worker);
         return(RedirectToAction("Index"));
     }
     //ViewBag.company_id = new SelectList(db.companies, "company_id", "name", worker.company_id);
     //ViewBag.identity_user_id = new SelectList(db.users, "Id", "Email", worker.identity_user_id);
     return(View(worker));
 }
 public ActionResult InitialRegister(InitialRegisterViewModel model)
 {
     if (ModelState.IsValid)
     {
         bool isPreRegistered = WorkersBL.IsWorkerPreRegistered(model.IdNumber);
         if (isPreRegistered)
         {
             ApprovalCodeManager codeManager = new ApprovalCodeManager(null);
             codeManager.SendCode(model.PhoneNumber, model.PhoneNumber);
             return(new HttpStatusCodeResult(200));
         }
     }
     return(new HttpStatusCodeResult(HttpStatusCode.MethodNotAllowed));
 }
        // GET: Company
        public ActionResult Index(int id)
        {
            var allWorkers = WorkersBL.GetAllWorkers(id);

            return(View(allWorkers));
        }
        public JsonResult Details(int workerId)
        {
            var worker = WorkersBL.GetWorker(workerId);

            return(Json(worker, JsonRequestBehavior.AllowGet));
        }
        //Worker Point-Of-View::
        //WorkerSettingsPage:
        public ActionResult Edit(int workerId)
        {
            var worker = WorkersBL.GetWorker(workerId);

            return(View(worker));
        }
Exemple #7
0
 public ActionResult Contact(ContactUsViewModel data)
 {
     ViewBag.Message = "צור קשר :";
     WorkersBL.SendContactUs(data.Subject, data.Content);
     return(View());
 }