public async Task <IActionResult> DeleteAsync(int id)
        {
            if (id < 1)
            {
                return(BadRequest(JsonSerializer.Serialize(new ErrorModel
                {
                    Message = "Hatali id girisi, lutfen 0 dan buyuk bir id giriniz!"
                })));
            }

            var orderLineHeader = await _orderLineService.GetAsync(i => i.Id == id);

            if (orderLineHeader.Status == Status.Error)
            {
                var errorModel = JsonSerializer.Serialize(new ErrorModel
                {
                    Message = "Veritabaninda bu idye sahip veri bulunamadi!"
                });

                return(BadRequest(errorModel));
            }

            var result = await _orderLineService.DeleteWithOrderHeaderAsync(id, orderLineHeader.Data.OrderHeaderId);

            return(Ok(new { Message = "Idsi girilen veri basariyla silindi!" }));
        }
Example #2
0
        public async Task <IActionResult> Delete(int id, int orderHeaderId)
        {
            var result = await _orderLineService.DeleteWithOrderHeaderAsync(id, orderHeaderId);

            if (result.Status == Status.Info)
            {
                return(RedirectToAction("GetLines", "Home", new { orderHeaderId }));
            }
            return(RedirectToAction("Index", "Home"));
        }