Klavzule
This commit is contained in:
@@ -123,21 +123,32 @@ namespace EveryThing.Pages.CodeTablePrePostText
|
||||
var insertedLinks = _context.CodeTablePrePostTextLink
|
||||
.Where(x => x.IdPrePostTextFk == idPrePostText);
|
||||
|
||||
var tableLinks = new StringBuilder();
|
||||
var tableLinksPreText = new StringBuilder();
|
||||
|
||||
typeof(CodeTablePrePostTextLink.LinkEnum).GetEnumListClass<DisplayAttribute>().ForEach(link =>
|
||||
{
|
||||
var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue);
|
||||
tableLinks.Append($"<tr data-link='{link.EnumValue}' data-idlink='{insertedLink?.IdPrePostTextLink ?? 0}'>");
|
||||
tableLinks.Append($"<td><input type='checkbox' class='chb-link' {((insertedLink?.IdPrePostTextLink ?? 0) > 0 ? "checked='checked'" : "")}/></td>");
|
||||
tableLinks.Append($"<td>{link.EnumAttribute.Name}</td>");
|
||||
tableLinks.Append("</tr>");
|
||||
var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue && x.Type == CodeTablePrePostTextLink.TypeEnum.PreText);
|
||||
tableLinksPreText.Append($"<tr data-link='{link.EnumValue}' data-type='{(int)CodeTablePrePostTextLink.TypeEnum.PreText}' data-idlink='{insertedLink?.IdPrePostTextLink ?? 0}'>");
|
||||
tableLinksPreText.Append($"<td><input type='checkbox' class='chb-link' {((insertedLink?.IdPrePostTextLink ?? 0) > 0 ? "checked='checked'" : "")}/></td>");
|
||||
tableLinksPreText.Append($"<td>{link.EnumAttribute.Name}</td>");
|
||||
tableLinksPreText.Append("</tr>");
|
||||
});
|
||||
|
||||
return new JsonResult(new { tableLinks = tableLinks.ToString(), successful = true });
|
||||
var tableLinksPostText = new StringBuilder();
|
||||
|
||||
typeof(CodeTablePrePostTextLink.LinkEnum).GetEnumListClass<DisplayAttribute>().ForEach(link =>
|
||||
{
|
||||
var insertedLink = insertedLinks.FirstOrDefault(x => (int)x.Link == link.EnumValue && x.Type == CodeTablePrePostTextLink.TypeEnum.PostText);
|
||||
tableLinksPostText.Append($"<tr data-link='{link.EnumValue}' data-type='{(int)CodeTablePrePostTextLink.TypeEnum.PostText}' data-idlink='{insertedLink?.IdPrePostTextLink ?? 0}'>");
|
||||
tableLinksPostText.Append($"<td><input type='checkbox' class='chb-link' {((insertedLink?.IdPrePostTextLink ?? 0) > 0 ? "checked='checked'" : "")}/></td>");
|
||||
tableLinksPostText.Append($"<td>{link.EnumAttribute.Name}</td>");
|
||||
tableLinksPostText.Append("</tr>");
|
||||
});
|
||||
|
||||
return new JsonResult(new { tableLinksPreText = tableLinksPreText.ToString(), tableLinksPostText = tableLinksPostText.ToString(), successful = true });
|
||||
}
|
||||
|
||||
public IActionResult OnPostLinkToggle(int idPrePostText, int link, int idPrePostTextLink)
|
||||
public IActionResult OnPostLinkToggle(int idPrePostText, int link, int type, int idPrePostTextLink)
|
||||
{
|
||||
var user = _userManager.GetUserAsync(User).Result;
|
||||
var idLink = 0;
|
||||
@@ -155,7 +166,8 @@ namespace EveryThing.Pages.CodeTablePrePostText
|
||||
var newLink = new CodeTablePrePostTextLink
|
||||
{
|
||||
IdPrePostTextFk = idPrePostText,
|
||||
Link = (CodeTablePrePostTextLink.LinkEnum)link
|
||||
Link = (CodeTablePrePostTextLink.LinkEnum)link,
|
||||
Type = (CodeTablePrePostTextLink.TypeEnum)type
|
||||
};
|
||||
|
||||
_context.CodeTablePrePostTextLink.Add(newLink);
|
||||
|
||||
Reference in New Issue
Block a user