예제 #1
0
        public async Task <ActionResult> RegisterPatient(CustomerRegisterPatient model)
        {
            if (ModelState.IsValid)
            {
                var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole();
                var user = new Domain.Entities.Patient {
                    UserName = model.Email, Email = model.Email, cin = model.cin, firstName = model.firstName, lastName = model.lastName, PhoneNumber = model.PhoneNumber, gender = model.gender, Address = model.Address, RoleUser = "******"
                };

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

                //if (result.Succeeded)
                //{
                //    await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);

                //    // For more information on how to enable account confirmation and password reset please visit http://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("Confirmation", "PatientAppointement");
                //}

                PatientAppointementController patientCont = new PatientAppointementController();
                //patientCont.Create().
                //AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(RedirectToAction("Confirmation", "PatientAppointement"));
        }
예제 #2
0
        public ActionResult Edit(double id ,FormCollection formvalues)
        {
            try
            {
                // TODO: Add update logic here
                Domain.Entities.Patient r = null;
                r = servicePatient.GetByIdF(id);
                r.PhoneNumber = formvalues["PhoneNumber"];
                r.UserName = formvalues["Email"];
                r.firstName = formvalues["FirstName"];
                r.lastName = formvalues["LastName"];
                r.Address = formvalues["Adresse"];

                servicePatient.Update(r);
                servicePatient.Commit();
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }