public int Update(LessonCommentDTO dto) { var entity = ModelMapper.Mapper.Map <LessonComment>(dto); entity.EntityState = EntityState.Modified; return(_lessonCommentRepository.Save(entity)); }
public ActionResult _CreateComment(LessonCommentDTO model) { model.EkleyenId = Convert.ToInt32(User.Claims.Where(c => c.Type == ClaimTypes.Name).Select(c => c.Value) .SingleOrDefault()); model.Guid = Guid.NewGuid(); model.EklenmeZamani = DateTime.Now; model.Aktif = true; model.Silindi = false; model.KullaniciId = Convert.ToInt32(User.Claims.Where(c => c.Type == ClaimTypes.Name).Select(c => c.Value) .SingleOrDefault()); model.LessonId = Convert.ToInt32(TempData["lessonId"]); _lessonCommentService.Create(model); var lesson = _lessonService.GetById(model.LessonId); return(RedirectToAction("GetLesson2", new RouteValueDictionary(new { controller = "Lesson", action = "GetLesson2", guid = lesson.Guid }))); }
public Result <LessonComment> AddComment(int lessonId, LessonCommentDTO dto) { //todo: check has enrolled/attended class LessonComment comment = new LessonComment() { Comment = dto.Comment, CreatedTime = DateTime.UtcNow, CreatedById = UserId, LessonId = lessonId }; _lessonRepository.AddComment(comment); //var response = Request.CreateResponse(HttpStatusCode.Created); // Generate a link to the new book and set the Location header in the response. //string uri = Url.Link("GetCommentById", new { lessonId = lessonId, id = comment.Id }); //response.Headers.Location = new Uri(uri); //return response; Result <LessonComment> res = new Result <LessonComment>(true, comment); return(res); }
public int Update(LessonCommentDTO lesson) { return(_lessonCommentRepository.Update(lesson)); }