Example #1
0
        //OK
        // GET: Client/Create
        public ActionResult Create()
        {
            ClientUserRoleDTO client = new ClientUserRoleDTO();

            client.RegistrationDate = DateTime.Now;

            client.Email                = "@mailinator.com";
            client.PasswordHash         = "Teodora!7";
            client.EmailConfirmed       = false;
            client.PhoneNumberConfirmed = false;
            client.TwoFactorEnabled     = false;
            client.LockoutEnabled       = false;
            client.AccessFailedCount    = 0;
            client.UserName             = "******";
            return(View(client));
        }
Example #2
0
        public async Task <ActionResult> Create(ClientUserRoleDTO client)
        {
            var errors = ModelState
                         .Where(x => x.Value.Errors.Count > 0)
                         .Select(x => new { x.Key, x.Value.Errors })
                         .ToArray();

            if (ModelState.IsValid)
            {
                try
                {
                    string roleId   = GetRoleIdOfClient();
                    string email    = client.Email;
                    string password = client.Password;
                    string userName = email;
                    // string roleName = collection["Name";
                    bool emailConfirmed       = false;
                    bool phoneNumberConfirmed = false;
                    bool twoFactorEnabled     = false;
                    bool lockoutEnabled       = false;
                    int  accesFailedCount     = 0;
                    //ovo gore dobro pokupi i sada trebam da ovog klijenta posaljem da kreira Identity i onda taj vraceni ID->upisem tog korisnika!!!
                    //////////////////////
                    string   firstName        = client.FirstName;
                    string   lastName         = client.LastName;
                    DateTime registrationDate = client.RegistrationDate;
                    DateTime dateOfBirth      = client.DateOfBirth;
                    string   description      = client.Description;

                    //////////////////////////
                    await clientDAO.Create(firstName, lastName, dateOfBirth, registrationDate, roleId, email, userName, password, emailConfirmed, phoneNumberConfirmed, twoFactorEnabled, lockoutEnabled, accesFailedCount, description);



                    return(RedirectToAction("Index"));
                    //return RedirectToAction("Details", new { id = id });
                }
                catch (Exception e)
                {
                    return(View("Error"));
                }
            }
            else
            {
                return(View("Create"));
            }
        }