public ActionResult Edit(int id) { var entity = _labelService.GetContentLabelById(id); var model = entity.MapTo <ContentLabelModel>(); PrepareContentLabelModel(model); return(View(model)); }
protected virtual void PreparePostDetailModel(PostDetailModel model, Post entity) { if (model == null) { throw new ArgumentNullException("model"); } var labels = _postLabelService.GetPostLabelsByPostId(entity.Id); model.ContentLabels = labels.Select(l => { var label = _labelService.GetContentLabelById(l.LabelId); var labelModel = label.MapTo <ContentLabelModel>(); return(labelModel); }).ToList(); }