public async Task <IActionResult> GetByIdAsync(int id) { if (id < 1) { return(BadRequest(JsonSerializer.Serialize(new ErrorModel { Message = "Hatali id girisi, lutfen 0 dan buyuk bir id giriniz!" }))); } var result = await _orderLineService.GetAsync(i => i.Id == id); if (result.Status == Status.Error) { var errorModel = JsonSerializer.Serialize(new ErrorModel { Message = "Veritabaninda bu idye sahip veri bulunamadi!" }); return(BadRequest(errorModel)); } var model = JsonSerializer.Serialize(_mapper.Map <OrderLineDto>(result.Data)); return(Ok(model)); }
public async Task <IActionResult> Update(int id) { var result = await _orderLineService.GetAsync(i => i.Id == id); if (result.Status == Status.Error) { return(RedirectToAction("Index", "Home")); } var model = _mapper.Map <OrderLineUpdateDto>(result.Data); return(PartialView("_OrderLineUpdatePartialView", model)); }