コード例 #1
0
        public void Return_IngredientType()
        {
            var ingredientType = new IngredientTypeDTO
            {
                Id   = Guid.Parse("619ac43c-075a-47be-befc-c68249054b85"),
                Name = "Rum"
            };

            var result = ingredientType.IngredientTypeDTOMapToModel();

            Assert.IsInstanceOfType(result, typeof(IngredientType));
        }
コード例 #2
0
        public async Task <IngredientTypeDTO> CreateIngredientType(IngredientTypeDTO ingredientTypeDTO)
        {
            if (ingredientTypeDTO == null)
            {
                throw new ArgumentNullException("Ingredient type doesn't exist!");
            }

            var ingredientType = ingredientTypeDTO.IngredientTypeDTOMapToModel();

            await _cmContext.IngredientTypes.AddAsync(ingredientType);

            await _cmContext.SaveChangesAsync();

            return(ingredientTypeDTO);
        }