Ejemplo n.º 1
0
        private async Task <ProfileViewModel> GetProfileViewModelAsync(Profile profile)
        {
            var result = _mapper.Map <ProfileViewModel>(profile);

            result.Images = (await _profileRepository.GetProfileImages(profile)).Select(i => i.Id);
            return(result);
        }
Ejemplo n.º 2
0
        // [EnableCors("AllowAll")]
        public async Task <IActionResult> CreateProfile([FromBody] Models.Profile item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            ApplicationDbContext.Profiles.Add(item);
            await ApplicationDbContext.SaveChangesAsync();

            return(this.CreatedAtRoute("GetProfileById", new { Controller = "ProfilesController", profileId = item.Id }, item));
        }