85 lines
2.5 KiB
C#
85 lines
2.5 KiB
C#
using AutoMapper;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using TTSW.EF;
|
|
using TTSW.Utils;
|
|
using TTSW.Constant;
|
|
using TTSW.Common;
|
|
using TodoAPI2.Models;
|
|
using System.IO;
|
|
using System.Web;
|
|
using System.Net;
|
|
using TTSW.Configure;
|
|
using Microsoft.Extensions.Options;
|
|
using System.Data;
|
|
|
|
namespace TodoAPI2.Models
|
|
{
|
|
public class rep_eva01Service : Irep_eva01Service
|
|
{
|
|
private IBaseRepository<eva_level_scoreEntity, Guid> _repository;
|
|
private IMyDatabase db;
|
|
private Iexternal_linkageService ext;
|
|
|
|
public rep_eva01Service(IBaseRepository<eva_level_scoreEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
|
|
{
|
|
_repository = repository;
|
|
db = mydb;
|
|
ext = inext;
|
|
}
|
|
|
|
#region Private Functions
|
|
private eva_level_scoreEntity GetEntity(rep_eva01InputModel model)
|
|
{
|
|
return Mapper.Map<eva_level_scoreEntity>(model);
|
|
}
|
|
private List<eva_level_scoreEntity> GetEntityList(List<rep_eva01InputModel> models)
|
|
{
|
|
return Mapper.Map<List<eva_level_scoreEntity>>(models);
|
|
}
|
|
private rep_eva01ViewModel GetDto(eva_level_scoreEntity entity)
|
|
{
|
|
return Mapper.Map<rep_eva01ViewModel>(entity);
|
|
}
|
|
private List<rep_eva01ViewModel> GetDtoList(List<eva_level_scoreEntity> entities)
|
|
{
|
|
return Mapper.Map<List<rep_eva01ViewModel>>(entities);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Public Functions
|
|
#region Query Functions
|
|
|
|
public rep_eva01WithSelectionViewModel GetWithSelection(Guid id)
|
|
{
|
|
var entity = _repository.Get(id);
|
|
var i = Mapper.Map<rep_eva01WithSelectionViewModel>(entity);
|
|
i.item_org_id = (from x in ext.GetSortingDep() select x).ToList();
|
|
i.item_round_id = (from x in ext.GetEvaRound() orderby x.external_code descending select x).ToList();
|
|
|
|
|
|
return i;
|
|
}
|
|
public rep_eva01WithSelectionViewModel GetBlankItem()
|
|
{
|
|
var i = new rep_eva01WithSelectionViewModel();
|
|
i.item_org_id = (from x in ext.GetSortingDep() select x).ToList();
|
|
i.item_round_id = (from x in ext.GetEvaRound() orderby x.external_code descending select x).ToList();
|
|
|
|
|
|
return i;
|
|
}
|
|
|
|
public DataContext GetContext()
|
|
{
|
|
return _repository.Context;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
} |