public IEnumerable <Link> Get(IResponseViewModel model) { return(new[] { GetSelfLink(model) }); }
private Action GetEditAction(IResponseViewModel model) { return(new EditAction( model.GetModelType(), _apiHelper.GetUri(model), _actionFormService.GetEditForm(model.GetModelType()))); }
public IDictionary <string, object> Get(IResponseViewModel model) { return(model.GetModelType() .GetProperties() .Where(p => !p.IsSubEntityType()) .ToDictionary(p => p.Name, p => p.GetValue(model))); }
public IEnumerable <Action> Get(IResponseViewModel model) { return(new[] { GetEditAction(model), GetDeleteAction(model.GetModelType(), model) }); }
private Link GetSelfLink(IResponseViewModel model) { return(new Link { Rel = new[] { "self" }, Href = _apiHelper.GetUri(model) }); }
public IEnumerable <SubEntity> Get(IResponseViewModel model) { return(model.GetModelType() .GetProperties() .Where(p => p.IsSubEntityType()) .SelectMany(p => GetSubEntities(p, model)) .ToArray()); }
private Entity CreateEntity(IResponseViewModel model) { return(new Entity { Actions = _actionsGenerator.Get(model), Class = _classGenerator.Get(model), Links = _linksGenerator.Get(model), Properties = _propertiesGenerator.Get(model), Entities = _subEntitiesGenerator.Get(model), Title = _titleGenerator.Get(model) }); }
private IEnumerable <SubEntity> GetParentSubEntity(IResponseViewModel model, IEnumerable <string> rel) { return(new SubEntity[] { new EmbeddedRepresentation { Class = _classGenerator.Get(model), Links = _linksGenerator.Get(model), Properties = _propertiesGenerator.Get(model), Rel = rel, Title = _titleGenerator.Get(model) } }); }
public static Type GetModelType(this IResponseViewModel viewModel) { return(viewModel.GetType().GetModelType()); }
private Action GetDeleteAction(Type modelType, IResponseViewModel model) { return(new DeleteAction(modelType, _apiHelper.GetUri(model))); }
public IEnumerable <string> Get(IResponseViewModel model) { return(Get(model.GetModelType())); }
public string GetUri(IResponseViewModel model) { return($"{GetUriBase(model.GetModelType())}/{model.Id}".ToLower()); }
public string Get(IResponseViewModel model) { return(Get(model.GetModelType())); }