Ejemplo n.º 1
0
        public HttpResponseMessage GetAllCurrency(BaseViewModel aCurrencyModel)
        {
            IUnitOfWork         uWork   = new UnitOfWork();
            ICurrencyRepository repo    = new CurrencyRepository(uWork);
            ICurrencyService    Service = new CurrencyService(repo);

            try
            {
                if (this.ModelState.IsValid)
                {
                    var currencyList = Service.GetAllCurrencyList(aCurrencyModel);
                    if (currencyList != null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, currencyList));
                    }
                    else
                    {
                        string message = "Error in getting Data";
                        return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
                    }
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message));
            }
        }