Update: Additional UI Extension Hooks
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using Disco.Models.UI.Config.DeviceBatch;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.DeviceBatch
|
||||
{
|
||||
public class CreateModel : ConfigDeviceBatchCreateModel
|
||||
{
|
||||
public Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,29 +3,30 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.UI.Config.DeviceBatch;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.DeviceBatch
|
||||
{
|
||||
public class IndexModel
|
||||
public class IndexModel : ConfigDeviceBatchIndexModel
|
||||
{
|
||||
public List<_IndexModelDeviceBatch> DeviceBatches { get; set; }
|
||||
public List<ConfigDeviceBatchIndexModelItem> DeviceBatches { get; set; }
|
||||
|
||||
public static IndexModel Build(DiscoDataContext dbContext)
|
||||
{
|
||||
var m = new IndexModel();
|
||||
m.DeviceBatches = dbContext.DeviceBatches.OrderBy(db => db.Name).Select(db => new _IndexModelDeviceBatch()
|
||||
m.DeviceBatches = dbContext.DeviceBatches.OrderBy(db => db.Name).Select(db => new _IndexModelItem()
|
||||
{
|
||||
Id = db.Id,
|
||||
Name = db.Name,
|
||||
PurchaseDate = db.PurchaseDate,
|
||||
PurchaseUnitQuantity = db.UnitQuantity,
|
||||
DeviceCount = db.Devices.Count,
|
||||
DeviceDecommissionedCount = db.Devices.Count(d=> d.DecommissionedDate.HasValue),
|
||||
DeviceDecommissionedCount = db.Devices.Count(d => d.DecommissionedDate.HasValue),
|
||||
DefaultDeviceModel = db.DefaultDeviceModel.Description,
|
||||
WarrantyExpires = db.WarrantyValidUntil,
|
||||
InsuranceSupplier = db.InsuranceSupplier,
|
||||
InsuredUntil = db.InsuredUntil
|
||||
}).ToList();
|
||||
}).Cast<ConfigDeviceBatchIndexModelItem>().ToList();
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Disco.Models.UI.Config.DeviceBatch;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@@ -6,10 +7,10 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.DeviceBatch
|
||||
{
|
||||
public class ShowModel
|
||||
public class ShowModel : ConfigDeviceBatchShowModel
|
||||
{
|
||||
public Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; }
|
||||
public List<SelectListItem> DeviceModels { get; set; }
|
||||
public List<Disco.Models.Repository.DeviceModel> DeviceModels { get; set; }
|
||||
public int DeviceCount { get; set; }
|
||||
public int DeviceDecommissionedCount { get; set; }
|
||||
public bool CanDelete { get; set; }
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using Disco.Models.UI.Config.DeviceBatch;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.DeviceBatch
|
||||
{
|
||||
public class TimelineModel : ConfigDeviceBatchTimelineModel
|
||||
{
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -3,10 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Disco.Models.UI.Config.DeviceBatch;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.DeviceBatch
|
||||
{
|
||||
public class _IndexModelDeviceBatch
|
||||
public class _IndexModelItem : ConfigDeviceBatchIndexModelItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
Reference in New Issue
Block a user