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
|
||||
&& EF.Functions.Like(x.Title, $"%{searchString}%")
|
||||
|| EF.Functions.Like(x.Description, $"%{searchString}%"))
|
||||
.Include(j => j.Company).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();
|
||||
//}
|
||||
.Include(j => j.Company)
|
||||
.OrderByDescending(x => x.IdItem).Take(100).ToListAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
<input type="hidden" asp-for="Invoice.InvoiceYear"/>
|
||||
<input type="hidden" asp-for="Invoice.InvoiceNumber"/>
|
||||
<input type="hidden" asp-for="@ViewData["Reffer"]" />
|
||||
<input type="hidden" asp-for="Reffer" />
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="form-group">
|
||||
|
||||
@@ -58,36 +58,50 @@ namespace EveryThing.Pages.Invoices
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Invoice = await _context.Invoices
|
||||
.Include(f => f.Company).FirstOrDefaultAsync(m => m.IdInvoice == id);
|
||||
var result = await LoadInvoiceData(id);
|
||||
|
||||
var user = _userManager.GetUserAsync(User).Result;
|
||||
|
||||
if (Invoice == null)
|
||||
if (!result)
|
||||
{
|
||||
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
|
||||
.Include(f => f.Item)
|
||||
.Where(m => m.IdInvoiceFk == id)
|
||||
.ToListAsync();
|
||||
|
||||
var user = _userManager.GetUserAsync(User).Result;
|
||||
|
||||
ViewData["Type"] = (int)Invoice.Type;
|
||||
ViewData["IdPartnerFk"] = new SelectList(_context.CodeTablePartners.Where(x => x.IdCompanyFk == user.IdCompanyFk && x.Active), "IdPartner", "Title");
|
||||
|
||||
ViewData["States"] = new SelectList(Enum.GetValues(typeof(Models.Invoice.Invoice.InvoiceState))
|
||||
.Cast<Models.Invoice.Invoice.InvoiceState>()
|
||||
.Where(x => GetAttribute<Models.Invoice.Invoice.InvoiceStateAttribute>(x).AllowedTypes.Split(',').Contains(((int)Invoice.Type).ToString()))
|
||||
.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");
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
return Page();
|
||||
return true;
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user