Example #1
0
        public static PaskolUser UserFromArtistAgentDetails(this ArtistAgentEditView userDetails, PaskolUser user)
        {
            PaskolUser RetUser = userDetails.UserFromUserDetails(user);

            if (RetUser.ArtistAgent == null)
            {
                RetUser.ArtistAgent = new ArtistAgent();
            }

            RetUser.ArtistAgent.CompanyName = userDetails.CompanyName;
            RetUser.UserType = UserType.ArtistAgent;
            return(RetUser);
        }
Example #2
0
        public async Task <ActionResult> CreateArtistAgent(ArtistAgentEditView model)
        {
            if (ModelState.IsValid)
            {
                // For now artist and customer have the same properties
                PaskolUser user = model.UserFromArtistAgentDetails(null);
                user.Status = UserStatus.Active;

                IdentityResult res = await CreateUserAsync(user, model.Password,
                                                           new string[] { UserType.ArtistAgent.ToString() });

                if (res.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View());
        }
Example #3
0
        public async Task <ActionResult> EditArtistAgent(ArtistAgentEditView EditedArtistAgent)
        {
            if (ModelState.IsValid)
            {
                PaskolUser user = await UserManager.FindByIdAsync(EditedArtistAgent.UserID);

                if (user != null)
                {
                    // Save artist details
                    EditedArtistAgent.UserFromArtistAgentDetails(user);

                    if (await UpdateUserAsync(user, EditedArtistAgent.Password))
                    {
                        return(RedirectToAction("index"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "User Not Found");
                }
            }

            return(View(EditedArtistAgent));
        }