Пример #1
0
        public HttpResponseMessage GetCultures(CultureModel aCultureModel)
        {
            //IUnitOfWork uWork = new UnitOfWork();
            //ICountryRepository country_repo = new CountryRepository(uWork);
            //ICountryService country_Service = new CountryService(country_repo);
            try
            {
                //if (this.ModelState.IsValid)
                //{
                //    CountryModel aCountryModel = new CountryModel();
                //    aCountryModel.CurrentCulture = aCultureModel.CurrentCulture;
                //    aCountryModel.CurrentUserID = aCultureModel.CurrentUserID;

                //    var culList = service.GetAllCultureList(aCultureModel);
                //    var countryList = country_Service.GetAllCountryList(aCountryModel);

                //    if (culList != null && countryList !=null)
                //    {
                //        var result = (from c in countryList
                //                      join cl in culList on c.Id equals cl.CountryID
                //                      select new
                //                      {
                //                          Id = cl.ID,
                //                          Country = c.Name,
                //                          Code = cl.Code,
                //                          IsActive = cl.IsActive

                //                      }).ToList();
                //        return Request.CreateResponse(HttpStatusCode.OK, result);
                //    }
                //    else
                //    {
                //        string message = "Error in getting Data";
                //        return Request.CreateErrorResponse(HttpStatusCode.Forbidden, message);
                //    }

                //}
                //else
                //{
                //    return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                //}
                var result = service.GetAllCultureList(aCultureModel);
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message));
            }
        }