@manhnguyenv

Welcome to my blog!

WinForms + RestSharp + ASP.NET Web API 2

February 22, 2020 15:30

ASP.NET Web API 2, RestSharp and Model Error Messages

CallerRepository class

static void Main(string[] args)
{
    EmployeeInfo model = new EmployeeInfo();
    CallerRepository caller = new CallerRepository();
    try
    {
        var response = caller.Get();
        foreach (var res in response)
        {
            Console.WriteLine($"{res.Id} {res.EmpNo} {res.EmpName} {res.Salary} {res.DeptName} {res.Designation}");
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Error Occured " +
            $"{ex.Message}");
    }
    Console.ReadLine();
}

https://www.dotnetcurry.com/aspnet/1419/handle-webapi-restsharp-model-error-messages

Categories

Recent posts