diff --git a/ApiControllers/eva_level_score_detailControllers.cs b/ApiControllers/eva_level_score_detailControllers.cs new file mode 100644 index 0000000..eb4368d --- /dev/null +++ b/ApiControllers/eva_level_score_detailControllers.cs @@ -0,0 +1,403 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Logging; +using TTSW.Controllers; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; +using System.Data; +using Microsoft.Extensions.Configuration; +using System.IO; +using System.Net; + +namespace TodoAPI2.Controllers +{ + //[Authorize] + [Produces("application/json")] + [Route("api/eva_level_score_detail")] + public class eva_level_score_detailController : BaseController + { + #region Private Variables + private ILogger _logger; + private Ieva_level_score_detailService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public eva_level_score_detailController(ILogger logger, Ieva_level_score_detailService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + /// + /// Get specific item by id + /// + /// + /// + /// Return Get specific item by id + /// Returns the item + /// Error Occurred + [HttpGet("{id}")] + [ProducesResponseType(typeof(eva_level_score_detailWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Get(Guid id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetWithSelection(id); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult Get.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(eva_level_score_detailWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetBlankItem() + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetBlankItem(); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get list items by level_score_id + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetList(Guid level_score_id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBylevel_score_id(level_score_id)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetList.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get list items by search + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("GetListBySearch")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetListBySearch(eva_level_score_detailSearchModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBySearch(model)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("eva_level_score_detail_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult eva_level_score_detail_report(eva_level_score_detailReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = new WebClient(); + string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL"); + string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite"); + string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username"); + string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password"); + + string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}"; + + if (model.filetype == "xlsx") + { + url += "&ignorePagination=true"; + } + + var data = httpclient.DownloadData(url); + var stream = new MemoryStream(data); + + return File(stream, model.contentType); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while GetReport.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Create new item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPost("")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Insert([FromBody] eva_level_score_detailInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Insert(model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"เพิ่มข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while insert.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update item + /// + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Update(Guid id, [FromBody] eva_level_score_detailInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Update(id, model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"แก้ไขข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while update {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Delete item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpDelete("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Delete(Guid id) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + _repository.Delete(id); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"ลบข้อมูล เรียบร้อย"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while delete {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update multiple item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("UpdateMultiple")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult UpdateMultiple([FromBody] List model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + string rowCount = _repository.UpdateMultiple(model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while UpdateMultiple.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Refresh AutoField of all items + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("RefreshAutoField")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult RefreshAutoField() + { + if (ModelState.IsValid) + { + try + { + //if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + _repository.RefreshAutoFieldOfAllData(); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while RefreshAutoField.", ex); + return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + + + } +} diff --git a/EF/DataContext.cs b/EF/DataContext.cs index 99c4dd0..6f72bd0 100644 --- a/EF/DataContext.cs +++ b/EF/DataContext.cs @@ -46,7 +46,7 @@ namespace TTSW.EF { public DbSet eva_evaluation_achievement_attach { get; set; } public DbSet activity_log_eva { get; set; } public DbSet eva_setup_permission { get; set; } - + public DbSet eva_level_score_detail { get; set; } protected override void OnModelCreating (ModelBuilder modelBuilder) { base.OnModelCreating (modelBuilder); diff --git a/EXCEL/eva_level_score_detail.xlsx b/EXCEL/eva_level_score_detail.xlsx new file mode 100644 index 0000000..ab9c57f Binary files /dev/null and b/EXCEL/eva_level_score_detail.xlsx differ diff --git a/Models/eva_level_score_detail/Ieva_level_score_detailService.cs b/Models/eva_level_score_detail/Ieva_level_score_detailService.cs new file mode 100644 index 0000000..f1aee1e --- /dev/null +++ b/Models/eva_level_score_detail/Ieva_level_score_detailService.cs @@ -0,0 +1,32 @@ +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; + +namespace TodoAPI2.Models +{ + public interface Ieva_level_score_detailService : IBaseService2 + { + new eva_level_score_detailViewModel Insert(eva_level_score_detailInputModel model, bool is_force_save); + new eva_level_score_detailViewModel Update(Guid id, eva_level_score_detailInputModel model, bool is_force_save); + List GetListBylevel_score_id(Guid level_score_id); + List GetListBySearch(eva_level_score_detailSearchModel model); + + string UpdateMultiple(List model, bool is_force_save); + eva_level_score_detailWithSelectionViewModel GetWithSelection(Guid id); + eva_level_score_detailWithSelectionViewModel GetBlankItem(); + + void RefreshAutoFieldOfAllData(); + eva_level_score_detailEntity GetEntity(Guid id); + DataContext GetContext(); + + + + } +} + diff --git a/Models/eva_level_score_detail/eva_level_score_detailEntity.cs b/Models/eva_level_score_detail/eva_level_score_detailEntity.cs new file mode 100644 index 0000000..12e8345 --- /dev/null +++ b/Models/eva_level_score_detail/eva_level_score_detailEntity.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using System.IO; + +namespace TodoAPI2.Models +{ + public class eva_level_score_detailEntity : BaseEntity2 + { + + + [ForeignKey("level_score_id")] + public eva_level_scoreEntity eva_level_score_level_score_id { get; set; } + public Guid level_score_id { get; set; } + + public decimal? min_value { get; set; } + + public decimal? max_value { get; set; } + + public decimal? min_percentage { get; set; } + + public decimal? max_percentage { get; set; } + + + public void SetAutoField(DataContext context) + { + + } + + public void DoAfterInsertUpdate(DataContext context) + { + + } + + } +} diff --git a/Models/eva_level_score_detail/eva_level_score_detailInputModel.cs b/Models/eva_level_score_detail/eva_level_score_detailInputModel.cs new file mode 100644 index 0000000..e628bfb --- /dev/null +++ b/Models/eva_level_score_detail/eva_level_score_detailInputModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_level_score_detailInputModel + { + + public Guid? id { get; set; } + + public Guid level_score_id { get; set; } + + public decimal? min_value { get; set; } + + public decimal? max_value { get; set; } + + public decimal? min_percentage { get; set; } + + public decimal? max_percentage { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/eva_level_score_detail/eva_level_score_detailReportRequestModel.cs b/Models/eva_level_score_detail/eva_level_score_detailReportRequestModel.cs new file mode 100644 index 0000000..84587aa --- /dev/null +++ b/Models/eva_level_score_detail/eva_level_score_detailReportRequestModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_level_score_detailReportRequestModel : eva_level_score_detailSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/eva_level_score_detail/eva_level_score_detailSearchModel.cs b/Models/eva_level_score_detail/eva_level_score_detailSearchModel.cs new file mode 100644 index 0000000..d6970b8 --- /dev/null +++ b/Models/eva_level_score_detail/eva_level_score_detailSearchModel.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_level_score_detailSearchModel + { + + public Guid id { get; set; } + + public Guid level_score_id { get; set; } + + } +} + diff --git a/Models/eva_level_score_detail/eva_level_score_detailService.cs b/Models/eva_level_score_detail/eva_level_score_detailService.cs new file mode 100644 index 0000000..35868dc --- /dev/null +++ b/Models/eva_level_score_detail/eva_level_score_detailService.cs @@ -0,0 +1,288 @@ +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 eva_level_score_detailService : Ieva_level_score_detailService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + + public eva_level_score_detailService(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext) + { + _repository = repository; + db = mydb; + ext = inext; + } + + #region Private Functions + private eva_level_score_detailEntity GetEntity(eva_level_score_detailInputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private eva_level_score_detailViewModel GetDto(eva_level_score_detailEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public eva_level_score_detailViewModel Get(Guid id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + + public eva_level_score_detailEntity GetEntity(Guid id) + { + var entity = _repository.Get(id); + + return entity; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + public eva_level_score_detailWithSelectionViewModel GetWithSelection(Guid id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + + + return i; + } + public eva_level_score_detailWithSelectionViewModel GetBlankItem() + { + var i = new eva_level_score_detailWithSelectionViewModel(); + + + return i; + } + + public List GetListBylevel_score_id(Guid level_score_id) + { + var model = new eva_level_score_detailSearchModel(); + model.level_score_id = level_score_id; + return GetListBySearch(model); + } + + public List GetListBySearch(eva_level_score_detailSearchModel model) + { + var data = ( + from m_eva_level_score_detail in _repository.Context.eva_level_score_detail + + join fk_eva_level_score1 in _repository.Context.eva_level_score on m_eva_level_score_detail.level_score_id equals fk_eva_level_score1.id + into eva_level_scoreResult1 + from fk_eva_level_scoreResult1 in eva_level_scoreResult1.DefaultIfEmpty() + + + where + 1 == 1 + && (m_eva_level_score_detail.level_score_id == model.level_score_id) + + + orderby m_eva_level_score_detail.created descending + select new eva_level_score_detailViewModel() + { + id = m_eva_level_score_detail.id, + level_score_id = m_eva_level_score_detail.level_score_id, + min_value = m_eva_level_score_detail.min_value, + max_value = m_eva_level_score_detail.max_value, + min_percentage = m_eva_level_score_detail.min_percentage, + max_percentage = m_eva_level_score_detail.max_percentage, + + level_score_id_eva_level_score_code = fk_eva_level_scoreResult1.code, + + isActive = m_eva_level_score_detail.isActive, + Created = m_eva_level_score_detail.created, + Updated = m_eva_level_score_detail.updated + } + ).Take(1000).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + + + public eva_level_score_detailViewModel Insert(eva_level_score_detailInputModel model, bool is_force_save) + { + var entity = GetEntity(model); + entity.id = Guid.NewGuid(); + + + entity.SetAutoField(_repository.Context); + + if (is_force_save) + { + var inserted = _repository.Insert(entity); + entity.DoAfterInsertUpdate(_repository.Context); + return Get(inserted.id); + } + else + { + _repository.InsertWithoutCommit(entity); + entity.DoAfterInsertUpdate(_repository.Context); + return Mapper.Map(entity); + } + } + + public eva_level_score_detailViewModel Update(Guid id, eva_level_score_detailInputModel model, bool is_force_save) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.level_score_id = model.level_score_id; + existingEntity.min_value = model.min_value; + existingEntity.max_value = model.max_value; + existingEntity.min_percentage = model.min_percentage; + existingEntity.max_percentage = model.max_percentage; + + existingEntity.SetAutoField(_repository.Context); + + if (is_force_save) + { + var updated = _repository.Update(id, existingEntity); + existingEntity.DoAfterInsertUpdate(_repository.Context); + return Get(updated.id); + } + else + { + _repository.UpdateWithoutCommit(id, existingEntity); + existingEntity.DoAfterInsertUpdate(_repository.Context); + return Mapper.Map(existingEntity); + } + } + else + throw new NotificationException("No data to update"); + } + + public string UpdateMultiple(List model, bool is_force_save) + { + foreach(var i in model) + { + if (i.active_mode == "1" && i.id.HasValue) // update + { + var existingEntity = _repository.Get(i.id.Value); + if (existingEntity != null) + { + existingEntity.level_score_id = i.level_score_id; + existingEntity.min_value = i.min_value; + existingEntity.max_value = i.max_value; + existingEntity.min_percentage = i.min_percentage; + existingEntity.max_percentage = i.max_percentage; + + existingEntity.SetAutoField(_repository.Context); + _repository.UpdateWithoutCommit(i.id.Value, existingEntity); + } + } + else if (i.active_mode == "1" && !i.id.HasValue) // add + { + var entity = GetEntity(i); + entity.id = Guid.NewGuid(); + entity.SetAutoField(_repository.Context); + _repository.InsertWithoutCommit(entity); + } + else if (i.active_mode == "0" && i.id.HasValue) // remove + { + _repository.DeleteWithoutCommit(i.id.Value); + } + else if (i.active_mode == "0" && !i.id.HasValue) + { + // nothing to do + } + } + if (is_force_save) + { + _repository.Context.SaveChanges(); + } + + return model.Count().ToString(); + } + + public eva_level_score_detailViewModel SetAsActive(Guid id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public eva_level_score_detailViewModel SetAsInactive(Guid id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(Guid id) + { + _repository.Delete(id); + + return; + } + + public void RefreshAutoFieldOfAllData() + { + var all_items = from i in _repository.Context.eva_level_score_detail + select i; + foreach (var item in all_items) + { + item.SetAutoField(_repository.Context); + } + _repository.Context.SaveChanges(); + } + + private Dictionary GetLookupForLog() + { + var i = new Dictionary(); + + + i.Add("level_score_id", "level_score_id"); + i.Add("level_score_id_eva_level_score_code", "level_score_id"); + i.Add("min_value", "ช่วงคะแนนต่ำสุด"); + i.Add("max_value", "ช่วงคะแนนสูงสุด"); + i.Add("min_percentage", "ร้อยละที่ได้เลื่อนต่ำสุด"); + i.Add("max_percentage", "ร้อยละที่ได้เลื่อนสูงสุด"); + + return i; + } + + #endregion + + #region Match Item + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/Models/eva_level_score_detail/eva_level_score_detailViewModel.cs b/Models/eva_level_score_detail/eva_level_score_detailViewModel.cs new file mode 100644 index 0000000..00c6daa --- /dev/null +++ b/Models/eva_level_score_detail/eva_level_score_detailViewModel.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class eva_level_score_detailViewModel : BaseViewModel2 + { + + public Guid level_score_id { get; set; } + + public decimal? min_value { get; set; } + + public decimal? max_value { get; set; } + + public decimal? min_percentage { get; set; } + + public decimal? max_percentage { get; set; } + + public string level_score_id_eva_level_score_code { get; set; } + + } +} \ No newline at end of file diff --git a/Models/eva_level_score_detail/eva_level_score_detailWithSelectionViewModel.cs b/Models/eva_level_score_detail/eva_level_score_detailWithSelectionViewModel.cs new file mode 100644 index 0000000..ccc6296 --- /dev/null +++ b/Models/eva_level_score_detail/eva_level_score_detailWithSelectionViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class eva_level_score_detailWithSelectionViewModel: eva_level_score_detailViewModel + { + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index f84face..1f47a9f 100644 --- a/Startup.cs +++ b/Startup.cs @@ -340,6 +340,9 @@ namespace Test01 services.AddScoped, BaseRepository2>(); services.AddScoped(); + services.AddScoped, BaseRepository2>(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -643,6 +646,9 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); }); #endregion diff --git a/Views/eva_level_scoreView/eva_level_score_d.cshtml b/Views/eva_level_scoreView/eva_level_score_d.cshtml index 9b847c5..b3806fc 100644 --- a/Views/eva_level_scoreView/eva_level_score_d.cshtml +++ b/Views/eva_level_scoreView/eva_level_score_d.cshtml @@ -5,6 +5,59 @@ Layout = "_LayoutDirect"; } + +