예제 #1
0
        public async Task <IActionResult> Add(AppConfigInsert model)
        {
            if (ModelState.IsValid)
            {
                var result = await _appConfigService.Insert(model);

                if (result.IsSuccess)
                {
                    TempData["Update"] = result.ToJson();
                    return(RedirectToAction("Index"));
                }

                ModelState.AddModelError("", result.Message);
            }
            return(View(model));
        }
예제 #2
0
        public async Task <TResponse <bool> > Insert(AppConfigInsert request)
        {
            try
            {
                var url      = ApiUrl.APP_CONFIG_INSERT;
                var response = await HttpService.Send <bool>(url,
                                                             request,
                                                             HttpMethod.Post,
                                                             true);

                if (response.IsSuccess)
                {
                    return(await Ok(true));
                }

                return(await Fail <bool>(response.Message));
            }
            catch (Exception exception)
            {
                return(await Fail <bool>(exception));
            }
        }