Exemple #1
0
        public async Task <ActionResult> CreateInterest(InterestVM interest)
        {
            var existingInterest = userProfileUnitOfWork.Interests.Get(i => i.Title == interest.Title).FirstOrDefault();

            if (existingInterest != null)
            {
                return(RedirectToAction("Dashboard"));
            }


            var interestModel = Mapper.Map <Interest>(interest);

            userProfileUnitOfWork.Interests.InsertOrUpdate(interestModel);
            await userProfileUnitOfWork.CompleteAsync();

            var group = new Group {
                InterestId = interestModel.Id,
                Title      = interestModel.Title
            };

            storyUnitOfWork.Groups.InsertOrUpdate(group);
            await storyUnitOfWork.CompleteAsync();

            return(RedirectToAction("Dashboard"));
        }
 private void AssertPocoEqualsVM(Interest expected, InterestVM actual)
 {
     Assert.Equal(expected.Id, actual.Id);
     Assert.Equal(expected.Title, actual.Title);
 }