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)
     });
 }
示例#6
0
 public IEnumerable <SubEntity> Get(IResponseViewModel model)
 {
     return(model.GetModelType()
            .GetProperties()
            .Where(p => p.IsSubEntityType())
            .SelectMany(p => GetSubEntities(p, model))
            .ToArray());
 }
示例#7
0
 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)
     });
 }
示例#8
0
 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)
         }
     });
 }
示例#9
0
 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()));
 }
示例#12
0
 public string GetUri(IResponseViewModel model)
 {
     return($"{GetUriBase(model.GetModelType())}/{model.Id}".ToLower());
 }
 public string Get(IResponseViewModel model)
 {
     return(Get(model.GetModelType()));
 }