public void Create_ValidModel_ReturnId(int newId)
        {
            //arrange
            var newItem = new UserProfile();

            //act
            var service  = new UserProfileService(_userProfileRepository.Object, _logger.Object);
            var returnId = service.Create(newItem);

            //assert
            Assert.Equal(newId, returnId);
            Assert.NotEqual(0, newItem.Id);
            Assert.NotEqual(DateTime.MinValue, newItem.Created);
            Assert.True(_data.Count == 2);
        }
示例#2
0
        public ActionResult <UserProfile> Create(UserProfile profile)
        {
            _profileService.Create(profile);

            return(CreatedAtRoute("GetProfiles", new { id = profile.Id.ToString() }, profile));
        }
 public void Post([FromBody] UserProfile userProfile)
 {
     _userProfileService.Create(userProfile);
 }
 public ActionResult Create(UserProfileViewModel userProfileVM)
 {
     userProfileService.Create(userProfileVM);
     return(RedirectToAction("Index"));
 }