public ActionResult GetComments() { _serv = new CommentsApiController(); var model = new CommentsViewModal(); model.Comments = string.Empty; model.List = AutoMapper.Mapper.Map <List <CommentsViewModal> >(_serv.GetComments().Where(x => x.Email == User.Identity.Name.Trim()).ToList()); return(PartialView("_List", model.List)); }
public async Task <ActionResult> Create(CommentsViewModal collection) { try { _serv = new CommentsApiController(); collection.Email = User.Identity.Name; await _serv.PostCommentsModal(AutoMapper.Mapper.Map <CommentsViewModal, CommentsModal>(collection)); // TODO: Add insert logic here return(RedirectToAction("Index")); } catch (Exception ex) { log.Error(ex.ToString()); return(View()); } }