示例#1
0
        internal RecipeDetailModel Insert(RecipeDetailModel detail)
        {
            using (var cookBookDbContext = dbContextFactory())
            {
                var entity = mapper.MapDetailModelToEntity(detail);
                entity.Id = Guid.NewGuid();

                cookBookDbContext.Recipes.Add(entity);
                cookBookDbContext.SaveChanges();

                return(mapper.MapEntityToDetailModel(entity));
            }
        }