コード例 #1
0
 public async Task <IActionResult> PostNationalityAsync([FromBody] NationalityWriteResource record)
 {
     repo.Create(mapper.Map <NationalityWriteResource, Nationality>(await AttachUserIdToRecord(record)));
     return(StatusCode(200, new {
         response = ApiMessages.RecordCreated()
     }));
 }
コード例 #2
0
        public CreateNationalityResponse CreateNationality(CreateNationalityRequest request)
        {
            CreateNationalityResponse response = new CreateNationalityResponse();

            try
            {
                Nationality nationality = request.ConvertToNationality();
                _nationalityRepository.Create(nationality);
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return(response);
        }
コード例 #3
0
 public void CreateNationality(Nationality entity)
 {
     _nationalityRepository.Create(entity);
 }