示例#1
0
        public IHttpActionResult CreatePost(CountryViewModel model)
        {
            var response = new SimpleResponse <CountryViewModel>();

            response = iCountryBusiness.Create(model);
            return(Json(response));
        }
示例#2
0
        public SimpleResponse <CountryDto> Create(CountryDto dto)
        {
            var response = new SimpleResponse <CountryDto>();

            try
            {
                var model = SimpleMapper.Map <CountryDto, CountryViewModel>(dto);
                var resp  = iCountryBusiness.Create(model);
                response = new SimpleResponse <CountryDto>()
                {
                    ResponseCode    = resp.ResponseCode,
                    ResponseMessage = resp.ResponseMessage,
                    RCode           = resp.RCode
                };

                response.Data = SimpleMapper.Map <CountryViewModel, CountryDto>(resp.Data);
            }
            catch (Exception ex)
            {
                response.ResponseCode    = BusinessResponseValues.InternalError;
                response.ResponseMessage = "Okuma iþleminde hata oluþtu.";
                SimpleFileLogger.Instance.Error(ex);
            }

            return(response);
        }
示例#3
0
        public IActionResult CreatePost(CountryViewModel model)
        {
            var response = iCountryBusiness.Create(model);

            if (response.ResponseCode > 0)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError(string.Empty, response.ResponseMessage);
                return(View("Create", model));
            }
        }
示例#4
0
 public IActionResult Post([FromBody] Country input)
 {
     try
     {
         _Business.Create(input);
         return(Ok(input));
     }
     catch (EqualUniqueRowException ex)
     {
         AppLogger.Error(ex.Message, ex);
         return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status206PartialContent, ex.Message));
     }
     catch (Exception ex)
     {
         AppLogger.Error(ex.Message, ex);
         return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status500InternalServerError, ex.Message));
     }
 }
示例#5
0
        public SimpleResponse <CountryViewModel> Create(CountryViewModel model)
        {
            var response = iCountryBusiness.Create(model);

            return(response);
        }