public async Task <IHttpActionResult> Add(LessonAddDto model) { bool result = await _lessonService.Add(model); if (!result) { return(BadRequest()); } return(Ok()); }
public async Task <bool> Add(LessonAddDto model) { try { Lesson entity = new Lesson { Id = Guid.NewGuid(), Name = model.Name }; _context.Lesson.Add(entity); await _context.SaveChangesAsync(); return(true); } catch (Exception) { return(false); } }