public ActionResult GetOrderById(int id) { try { var result = Rep.GetOrderById(id); if (result != null) { return(Ok(Mapper.Map <Order, OrderViewModel>(result))); } else { return(NotFound()); } } catch (Exception ex) { Log.LogError($"Failed to retrive order by id :{ex}"); return(BadRequest("Failed to retrieve order")); } }