70 lines
2.0 KiB
C#
70 lines
2.0 KiB
C#
using CMS_CORE_Library.Models;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
|
|
namespace Step.Model.DTOModels.ToolModels
|
|
{
|
|
public class DTOShankModel
|
|
{
|
|
public int Id;
|
|
[Required]
|
|
public string Name { get; set; }
|
|
[Required]
|
|
public bool IsEnabled { get; set; }
|
|
[Required]
|
|
public bool IsInhibited { get; set; }
|
|
[Required]
|
|
public bool InChangeTool { get; set; }
|
|
[Required]
|
|
public bool InFixedPlace { get; set; }
|
|
[Required]
|
|
public bool InUse { get; set; }
|
|
[Required]
|
|
public int LeftSize { get; set; }
|
|
[Required]
|
|
public int RightSize { get; set; }
|
|
[Required]
|
|
public int MagazinePositionType { get; set; }
|
|
|
|
public List<DTOShankChildModel> ChildsTools { get; set; }
|
|
|
|
public static explicit operator ShankModel(DTOShankModel obj)
|
|
{
|
|
List<ShankChildModel> childs = obj.ChildsTools?.Select(x => new ShankChildModel
|
|
{
|
|
Id = x.Id,
|
|
FamilyName = x.FamilyName,
|
|
MultitoolId = x.MultitoolId,
|
|
ToolType = x.ToolType
|
|
}).ToList();
|
|
|
|
|
|
return new ShankModel()
|
|
{
|
|
Id = 0,
|
|
Name = obj.Name,
|
|
IsEnabled = obj.IsEnabled,
|
|
IsInhibited = obj.IsInhibited,
|
|
InChangeTool = obj.InChangeTool,
|
|
InFixedPlace = obj.InFixedPlace,
|
|
InUse = obj.InUse,
|
|
LeftSize = obj.LeftSize,
|
|
RightSize = obj.RightSize,
|
|
MagazinePositionType = obj.MagazinePositionType,
|
|
ChildsTools = childs
|
|
};
|
|
}
|
|
}
|
|
public class DTOShankChildModel
|
|
{
|
|
public int Id;
|
|
[Required]
|
|
public int MultitoolId;
|
|
[Required]
|
|
public string FamilyName;
|
|
[Required]
|
|
public int ToolType;
|
|
}
|
|
}
|