コード例 #1
0
        public async Task <IActionResult> FisDuzenle(FisDto ajaxData, int cariId)
        {
            if (Request.IsAjaxRequest())
            {
                var result = await _fisService.FisDuzenle(_mapper.Map <Fis>(ajaxData));

                if (result)
                {
                    return(PartialView("~/Views/Fis/FisListPartial.cshtml", _fisService.CariFisleri(cariId).PagedList(_mapper.Map <IEnumerable <Fis>, IEnumerable <FisDto> >, 1, 10)));
                }
                else
                {
                    return(BadRequest(new JsonError {
                        Error = "Fiş Düzenleme İşlemi Başarısız..."
                    }));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
コード例 #2
0
        public async Task <IActionResult> CariFisEkle(int Id, FisDto ajaxData)
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList().Distinct();
                return(BadRequest(JsonConvert.SerializeObject(errors)));
            }

            if (Request.IsAjaxRequest())
            {
                var user = await _userService.GetUserByIdAsync(Convert.ToInt32(User.FindFirst(ClaimTypes.NameIdentifier).Value));

                await _fisService.CariFisEkleAsync(_mapper.Map <Fis>(ajaxData), user, Id);

                return(PartialView("~/Views/Fis/FisListPartial.cshtml", _fisService.CariFisleri(Id).PagedList(_mapper.Map <IEnumerable <Fis>, IEnumerable <FisDto> >, 1, 10)));
            }



            return(RedirectToAction("Index", "Home"));
        }