public static Lesson ToDataModel(LessonHometaskInputModel lesson) { return(new Lesson { Id = lesson.Id, GroupId = lesson.GroupId, Date = Convert.ToDateTime(lesson.Date), Hometask = lesson.Hometask, Videos = lesson.Videos, ToRead = lesson.ToRead }); }
public async Task <ActionResult <int> > SetHometask([FromBody] LessonHometaskInputModel inputModel) { bool isUserInGroup = inputModel.GroupId == (await groupStorage.StudentGroupGetByUserId((int)inputModel.UserId)).GroupId; if (isUserInGroup) { return(await lessonStorage.AddOrUpdateLesson(LessonHometaskMapper.ToDataModel(inputModel))); } else { return(-1); } }