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), }); } }
public ScientificReportTypeViewModel(ScientificReportType scientificReportType) : this() { if (scientificReportType != null) { Id = scientificReportType.Id; Name = scientificReportType.Name; Score = scientificReportType.Score; HoursConverted = scientificReportType.HoursConverted; } }
public void GetScientificReportTypeFromModel(ScientificReportType scientificReportType) { scientificReportType.Name = Name; scientificReportType.Score = Score; scientificReportType.HoursConverted = HoursConverted; }