public async Task <IHttpActionResult> Update(LessonUpdateDto model)
        {
            var result = await _lessonService.Update(model);

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

            return(Ok());
        }
Example #2
0
        public async Task <bool> Update(LessonUpdateDto model)
        {
            try
            {
                var query = _context.Lesson.FirstOrDefault(x => x.Id == model.Id);
                query.Name = model.Name;

                await _context.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }