public async Task <IActionResult> OnGetAsync(int id) { var user = await _context.GetUserFullAsync(User); if (user == null) { return(NotFound()); } var resourceLink = user.Platform.ResourceLinks.SingleOrDefault(r => r.Id == id); if (resourceLink == null) { return(NotFound()); } ResourceLink = new ResourceLinkModel(resourceLink); Tools = user.Tools .OrderBy(tool => tool.Name) .Select(tool => new SelectListItem { Text = tool.Name, Value = tool.Id.ToString() }) .ToList(); return(Page()); }
public IHttpActionResult Save(ResourceLinkModel baseRequest) { //baseRequest.CreateBy = SecurityHelper.CurrentPrincipal.EmpNo; baseRequest.CreateDate = DateTime.Now; //baseRequest.OrgId = SecurityHelper.CurrentPrincipal.OrgId; var response = service.SaveResourceLink(baseRequest); return(Ok(response)); }
public async Task OnGetAsync() { var user = await _context.GetUserFullAsync(User); if (user == null) { return; } ResourceLinks = ResourceLinkModel.GetResourceLinks(user.Platform.ResourceLinks); }
public async Task <IViewComponentResult> InvokeAsync(int?courseId = null) { var model = new ResourceLinksViewComponentModel { CourseId = courseId }; var user = await _context.GetUserFullAsync(HttpContext.User); model.People = user.People.ToList(); model.ResourceLinks = ResourceLinkModel.GetResourceLinks(courseId.HasValue ? user.Course.ResourceLinks : user.Platform.ResourceLinks); return(View(model)); }
static NodeProperty WriteNodeLink( CodeGenerationContext codeGenContext, string linkRelationship, Uri linkUri, TypedExpression <string> resourceUri, ResourceLinkModel link) { var jsonWriter = codeGenContext.JsonWriter; IEnumerable <AnyExpression> getNodeLink() { yield return(jsonWriter.WritePropertyName(linkRelationship)); yield return(jsonWriter.WriteBeginObject()); yield return(jsonWriter.WriteRaw(Nodes.IdProperty)); var uriCombinationMethodInfo = link.CombinationType == ResourceLinkCombination.SubResource ? Reflection.HydraTextExtensions.UriSubResourceCombine : Reflection.HydraTextExtensions.UriStandardCombine; var uriCombine = new MethodCall <string>(Expression.Call( uriCombinationMethodInfo, resourceUri, Expression.Constant(linkUri, typeof(Uri)))); yield return(jsonWriter.WriteString(uriCombine)); if (link.Type != null) { yield return(jsonWriter.WriteValueSeparator()); yield return(jsonWriter.WritePropertyName("@type")); yield return(jsonWriter.WriteString(link.Type)); } yield return(jsonWriter.WriteEndObject()); } return(new NodeProperty(linkRelationship) { Code = new InlineCode(getNodeLink()) }); }
static NodeProperty WriteNodeLink( Variable <JsonWriter> jsonWriter, string linkRelationship, Uri linkUri, TypedExpression <string> resourceUri, ResourceLinkModel link) { IEnumerable <AnyExpression> getNodeLink() { yield return(jsonWriter.WritePropertyName(linkRelationship)); yield return(jsonWriter.WriteBeginObject()); yield return(jsonWriter.WriteRaw(Nodes.IdProperty)); var uriCombinationMethodInfo = link.CombinationType == ResourceLinkCombination.SubResource ? typeof(HydraTextExtensions).GetMethod(nameof(HydraTextExtensions.UriSubResourceCombine), BindingFlags.Static | BindingFlags.NonPublic) : typeof(HydraTextExtensions).GetMethod(nameof(HydraTextExtensions.UriStandardCombine), BindingFlags.Static | BindingFlags.NonPublic); var uriCombine = Expression.Call( uriCombinationMethodInfo, resourceUri, Expression.Constant(linkUri, typeof(Uri))); yield return(jsonWriter.WriteString(uriCombine)); if (link.Type != null) { yield return(jsonWriter.WriteValueSeparator()); yield return(jsonWriter.WritePropertyName("@type")); yield return(jsonWriter.WriteString(link.Type)); } yield return(jsonWriter.WriteEndObject()); } return(new NodeProperty(linkRelationship) { Code = new InlineCode(getNodeLink()) }); }
public async Task <IActionResult> OnGetAsync(int id) { var user = await _context.GetUserFullAsync(User); if (user == null) { return(NotFound()); } var resourceLink = user.Platform.ResourceLinks.SingleOrDefault(r => r.Id == id); if (resourceLink == null) { return(NotFound()); } ResourceLink = new ResourceLinkModel(resourceLink); return(Page()); }
public BaseResponse <ResourceLinkModel> SaveResourceLink(ResourceLinkModel request) { return(base.Save <LTC_RESOURCELINKREC, ResourceLinkModel>(request, (q) => q.ID == request.Id)); }