コード例 #1
0
        public async Task <IActionResult> Update(TechnologyUpdateRequestModel technologyUpdateRequestModel)
        {
            var isTechnologyUpdateSuccessful = await this.techologyService.UpdateTechnology(technologyUpdateRequestModel);

            if (!isTechnologyUpdateSuccessful)
            {
                return(BadRequest());
            }

            return(Ok());
        }
コード例 #2
0
        public async Task <bool> UpdateTechnology(TechnologyUpdateRequestModel technologyUpdateRequestModel)
        {
            var technology = await this.GetTechnologyById(technologyUpdateRequestModel.Id);

            if (technology == null)
            {
                return(false);
            }

            technology.Title       = technologyUpdateRequestModel.Title;
            technology.Description = technologyUpdateRequestModel.Description;

            await this.personalBlogDbContext.SaveChangesAsync();

            return(true);
        }