コード例 #1
0
        public async Task <ResponseModel> CreateScientificReportTypeAsync(ScientificReportTypeManageModel scientificReportTypeManageModel)
        {
            var scientificReportType = await _scientificReportTypeRepository.FetchFirstAsync(x => x.Name == scientificReportTypeManageModel.Name);

            if (scientificReportType != null)
            {
                return(new ResponseModel
                {
                    StatusCode = System.Net.HttpStatusCode.BadRequest,
                    Message = "This scientificReportType is exist"
                });
            }
            else
            {
                scientificReportType = new ScientificReportType();
                scientificReportTypeManageModel.GetScientificReportTypeFromModel(scientificReportType);
                await _scientificReportTypeRepository.InsertAsync(scientificReportType);

                return(new ResponseModel
                {
                    StatusCode = System.Net.HttpStatusCode.OK,
                    Data = new ScientificReportTypeViewModel(scientificReportType),
                });
            }
        }
コード例 #2
0
 public ScientificReportTypeViewModel(ScientificReportType scientificReportType) : this()
 {
     if (scientificReportType != null)
     {
         Id             = scientificReportType.Id;
         Name           = scientificReportType.Name;
         Score          = scientificReportType.Score;
         HoursConverted = scientificReportType.HoursConverted;
     }
 }
コード例 #3
0
 public void GetScientificReportTypeFromModel(ScientificReportType scientificReportType)
 {
     scientificReportType.Name           = Name;
     scientificReportType.Score          = Score;
     scientificReportType.HoursConverted = HoursConverted;
 }