zadnjih 100 artiklov
gumb nazaj da vrne na projekt
This commit is contained in:
@@ -60,21 +60,8 @@ namespace EveryThing.Pages.CodeTableItems
|
|||||||
.Where(x => x.IdCompanyFk == user.IdCompanyFk
|
.Where(x => x.IdCompanyFk == user.IdCompanyFk
|
||||||
&& EF.Functions.Like(x.Title, $"%{searchString}%")
|
&& EF.Functions.Like(x.Title, $"%{searchString}%")
|
||||||
|| EF.Functions.Like(x.Description, $"%{searchString}%"))
|
|| EF.Functions.Like(x.Description, $"%{searchString}%"))
|
||||||
.Include(j => j.Company).Take(100).ToListAsync();
|
.Include(j => j.Company)
|
||||||
|
.OrderByDescending(x => x.IdItem).Take(100).ToListAsync();
|
||||||
//Item = await _context.CodeTableItems
|
|
||||||
// .Where(x => x.IdCompanyFk == user.IdCompanyFk
|
|
||||||
// && (!search
|
|
||||||
// || EF.Functions.Like(x.Title, $"%{searchString}%")
|
|
||||||
// || (x.Description != null
|
|
||||||
// && EF.Functions.Like(x.Description, $"%{searchString}%"))))
|
|
||||||
// .Include(j => j.Company).Take(100).ToListAsync();
|
|
||||||
|
|
||||||
//if ()
|
|
||||||
//{
|
|
||||||
// Item = Item.Where(s => s.Title.Contains(searchString, StringComparison.InvariantCultureIgnoreCase)
|
|
||||||
// || (s.Description != null && s.Description.Contains(searchString, StringComparison.InvariantCultureIgnoreCase))).ToList();
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
<input type="hidden" asp-for="Invoice.InvoiceYear"/>
|
<input type="hidden" asp-for="Invoice.InvoiceYear"/>
|
||||||
<input type="hidden" asp-for="Invoice.InvoiceNumber"/>
|
<input type="hidden" asp-for="Invoice.InvoiceNumber"/>
|
||||||
<input type="hidden" asp-for="@ViewData["Reffer"]" />
|
<input type="hidden" asp-for="@ViewData["Reffer"]" />
|
||||||
|
<input type="hidden" asp-for="Reffer" />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -58,21 +58,31 @@ namespace EveryThing.Pages.Invoices
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Invoice = await _context.Invoices
|
var result = await LoadInvoiceData(id);
|
||||||
.Include(f => f.Company).FirstOrDefaultAsync(m => m.IdInvoice == id);
|
|
||||||
|
|
||||||
var user = _userManager.GetUserAsync(User).Result;
|
if (!result)
|
||||||
|
|
||||||
if (Invoice == null)
|
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> LoadInvoiceData(int? id)
|
||||||
|
{
|
||||||
|
Invoice = await _context.Invoices
|
||||||
|
.Include(f => f.Company).FirstOrDefaultAsync(m => m.IdInvoice == id);
|
||||||
|
|
||||||
|
|
||||||
|
if (Invoice == null) return false;
|
||||||
|
|
||||||
InvoiceItems = await _context.InvoiceItems
|
InvoiceItems = await _context.InvoiceItems
|
||||||
.Include(f => f.Item)
|
.Include(f => f.Item)
|
||||||
.Where(m => m.IdInvoiceFk == id)
|
.Where(m => m.IdInvoiceFk == id)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
var user = _userManager.GetUserAsync(User).Result;
|
||||||
|
|
||||||
ViewData["Type"] = (int)Invoice.Type;
|
ViewData["Type"] = (int)Invoice.Type;
|
||||||
ViewData["IdPartnerFk"] = new SelectList(_context.CodeTablePartners.Where(x => x.IdCompanyFk == user.IdCompanyFk && x.Active), "IdPartner", "Title");
|
ViewData["IdPartnerFk"] = new SelectList(_context.CodeTablePartners.Where(x => x.IdCompanyFk == user.IdCompanyFk && x.Active), "IdPartner", "Title");
|
||||||
|
|
||||||
@@ -82,12 +92,16 @@ namespace EveryThing.Pages.Invoices
|
|||||||
.Select(x => new { Name = GetAttribute<DisplayAttribute>(x).Name, Value = x.ToString() })
|
.Select(x => new { Name = GetAttribute<DisplayAttribute>(x).Name, Value = x.ToString() })
|
||||||
.ToList(), "Value", "Name");
|
.ToList(), "Value", "Name");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Request.Headers["Referer"]))
|
if (!string.IsNullOrEmpty(Reffer))
|
||||||
|
{
|
||||||
|
ViewData["Reffer"] = Reffer;
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(Request.Headers["Referer"]))
|
||||||
{
|
{
|
||||||
ViewData["Reffer"] = Reffer = Request.Headers["Referer"].ToString();
|
ViewData["Reffer"] = Reffer = Request.Headers["Referer"].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Page();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TAttribute GetAttribute<TAttribute>(Enum value)
|
public static TAttribute GetAttribute<TAttribute>(Enum value)
|
||||||
@@ -144,7 +158,9 @@ namespace EveryThing.Pages.Invoices
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToPage("./Edit", new { id = Invoice.IdInvoice});
|
await LoadInvoiceData(Invoice.IdInvoice);
|
||||||
|
|
||||||
|
return Page();// RedirectToPage("./Edit", new { id = Invoice.IdInvoice});
|
||||||
|
|
||||||
|
|
||||||
if (Reffer != null)
|
if (Reffer != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user