Example #1
0
        public async Task <CommandResult> UpdatePersonProfile(UpdatePersonProfileCommand cmd)
        {
            var profile = await _db.PersonProfiles.FindAsync(cmd.CurrentUserId);

            if (profile == null)
            {
                profile = new PersonProfile
                {
                    Id = cmd.CurrentUserId
                };
                _db.Add(profile);
            }

            profile.Bio       = cmd.Bio;
            profile.FirstName = cmd.FirstName;
            profile.LastName  = cmd.LastName;
            profile.LinkedIn  = cmd.LinkedIn;
            profile.OtherUrl  = cmd.OtherUrl;
            profile.Website   = cmd.Website;
            await _db.SaveChangesAsync();

            return(CommandResult.Success(cmd));
        }
 public async Task <IActionResult> UpdatePersonProfile([FromBody] UpdatePersonProfileCommand command) =>
 await HandleCommandAsync(command, _commandService.UpdatePersonProfile);