Пример #1
0
        /// <summary>
        /// update model in database
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task UpdateModelAsync(ModelUpdateInputDtoModel model)
        {
            var brand = await this.brandService.GetBrandByNameAsync(model.BrandName);

            var modelForUpdate = ModelServiceUpdateMapper.Map(model, brand);

            this.models.Update(modelForUpdate);
            await this.models.SaveAsync();
        }
Пример #2
0
        public static ModelUpdateInputDtoModel Map(ModelUpdateInputModel model)
        {
            var modelToUpdate = new ModelUpdateInputDtoModel()
            {
                Id           = model.Id,
                Name         = model.Name,
                StartYear    = model.StartYear,
                EndYear      = model.EndYear,
                ImageAddress = model.ImageAddress,
                BrandName    = model.BrandName,
            };

            return(modelToUpdate);
        }