/// <summary>
        /// Loads the data for partial view
        /// </summary>
        /// <returns>list of print template</returns>
        public async Task <List <PrintTemplateViewModel> > GetData()
        {
            List <PrintTemplateViewModel> listTemplates = null;

            try
            {
                HttpResponseMessage response = await Get("PrintTemplate/GetAll");

                if (response.IsSuccessStatusCode)
                {
                    var responseContent = await response.Content.ReadAsAsync <IEnumerable <SPPrintTemplateDto> >();

                    if (response.StatusCode == System.Net.HttpStatusCode.OK && responseContent != null)
                    {
                        listTemplates = this.templateMapper.ToObjects(responseContent).OrderByDescending(s => s.CreatedDate).ToList();
                    }
                    else
                    {
                        listTemplates = new List <PrintTemplateViewModel>();
                    }
                }
                else
                {
                    listTemplates = new List <PrintTemplateViewModel>();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }

            return(listTemplates);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get all users
        /// </summary>
        /// <returns>returns List of OwnerUserModel</returns>
        public async Task <List <OwnerUserModel> > GetAllUsers()
        {
            try
            {
                List <OwnerUserModel> userModelList = new List <OwnerUserModel>();
                var response = await Get("souser/GetAllUsers");

                if (response.IsSuccessStatusCode)
                {
                    var souser = await response.Content.ReadAsAsync <IEnumerable <SOUserDto> >();

                    var userList = userMapper.ToObjects(souser).ToList();

                    foreach (var userModel in userList)
                    {
                        string roleNames = string.Join(",", userModel.RoleNameList);
                        userModel.RoleNames = roleNames;
                        userModelList.Add(userModel);
                    }
                }

                return(userModelList);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(null);
            }
        }
 public HttpResponseMessage GetSolutionPartnerContactBySPId(int SOSPId, int dummyId)
 {
     try
     {
         var collection = soContactService.GetContactsByPartnerId(SOSPId);
         if (null != collection)
         {
             return(CreateHttpResponse(
                        HttpStatusCode.OK,
                        HttpCustomStatus.Success,
                        collection,
                        ""
                        ));
         }
         return(CreateHttpResponse(
                    HttpStatusCode.Accepted,
                    HttpCustomStatus.Failure,
                    collection,
                    "No data found."
                    ));
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         return(CreateHttpResponse <ISOSolutionPartnerContact>(
                    HttpStatusCode.ExpectationFailed,
                    HttpCustomStatus.Failure,
                    null,
                    "Web Service Error: Please report this problem or try again later."
                    ));
     }
 }
 public HttpResponseMessage GetAllFeatures()
 {
     try
     {
         var item = Task.Run(async() =>
         {
             return(await featureService.GetAllFeatures());
         });
         var features = item.Result;
         return(CreateHttpResponse <IEnumerable <ISOFeature> >(
                    HttpStatusCode.OK,
                    HttpCustomStatus.Success,
                    features,
                    GetLocalisedString("msgSuccess")));
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         return(CreateHttpResponse <ISOFeature>(
                    HttpStatusCode.ExpectationFailed,
                    HttpCustomStatus.Failure,
                    null,
                    GetLocalisedString("msgWebServiceError")));
     }
 }
        /// <summary>
        /// Loads the add pop up.
        /// </summary>
        /// <returns>returns _AddPopUp partial view</returns>
        public async Task <ActionResult> LoadAddPopUp()
        {
            try
            {
                FeatureViewModel featureVM = new FeatureViewModel();
                var categoryVMList         = await GetAllCategories();

                categoryVMList
                .ForEach(c => c.Children = categoryVMList
                                           .Where(x => x.ParentId == c.Id)
                                           .OrderBy(x => x.SortOrder)
                                           .ToList());
                categoryVMList = categoryVMList
                                 .Where(x => x.ParentId == 0 || x.ParentId == null)
                                 .ToList();
                featureVM.CategoryViewModelList = categoryVMList;
                ////return PartialView("_AddPopUp", featureVM);
                return(Json(new
                {
                    Status = 1,
                    Data = RenderRazorViewToString("_AddPopUp", featureVM),
                    Message = string.Empty
                }));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(Json(new { Status = 0, Data = "error", Message = ex.Message }));
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Loads the add role pop up.
        /// </summary>
        /// <returns>returns _AddPopUp partial view</returns>
        public async Task <ActionResult> LoadAddRolePopUp()
        {
            try
            {
                RoleViewModel roleVM           = new RoleViewModel();
                var           responseFeatures = await Get("sofeature/GetAllFeatures");

                List <FeatureViewModel> features = new List <FeatureViewModel>();
                if (responseFeatures.StatusCode == HttpStatusCode.OK)
                {
                    var featureList = await responseFeatures.Content.ReadAsAsync <IEnumerable <SOFeatureDto> >();

                    features = featureMapper.ToObjects(featureList).ToList();
                }

                var responseCategories = await Get("category/GetAllCategories");

                List <CategoryViewModel> categories = new List <CategoryViewModel>();
                if (responseFeatures.StatusCode == HttpStatusCode.OK)
                {
                    var categoryList = await responseCategories.Content.ReadAsAsync <IEnumerable <SOCategoryDto> >();

                    categories = categoryMapper.ToObjects(categoryList).ToList();
                }

                roleVM = SetRoleViewModel(roleVM, categories, features);

                return(Json(new { Status = 1, Data = RenderRazorViewToString("_AddPopUp", roleVM) }));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(Json(new { Status = 0, Data = "error", Message = ex.Message }));
            }
        }
Exemplo n.º 7
0
        ////private Person SerializeAndDeserialize(Person person)
        ////{
        ////    var indented = Formatting.Indented;
        ////    var settings = new JsonSerializerSettings()
        ////    {
        ////        TypeNameHandling = TypeNameHandling.All
        ////    };
        ////    var serialized = JsonConvert.SerializeObject(person, indented, settings);
        ////    var deserialized = JsonConvert.DeserializeObject(serialized, settings);
        ////    return deserialized;
        ////}

        /// <summary>
        /// Gets the currency list.
        /// </summary>
        /// <returns>Returns a list</returns>
        public async Task <ActionResult> GetCurrencyList()
        {
            try
            {
                List <CurrencyRateModel> currencyList = new List <CurrencyRateModel>();
                var brandingDetails = new SOBrandingDto();
                var currencyDetails = new SPCurrencyDto();

                currencyList = await GetAllCurrencyRate();

                var response = await Get("Branding/GetAll");

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    brandingDetails = await response.Content.ReadAsAsync <SOBrandingDto>();
                }

                var baseCurrencyResponse = await Get("SPCurrency/GetCurrencyById/" + brandingDetails.BaseCurrencyID);

                if (baseCurrencyResponse.StatusCode == HttpStatusCode.OK)
                {
                    currencyDetails = await baseCurrencyResponse.Content.ReadAsAsync <SPCurrencyDto>();
                }

                return(Json(new { Status = 1, Data = RenderRazorViewToString("_CurrencyList", currencyList), BaseCurrency = currencyDetails.Currency }));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(Json(new { Status = 0, Data = "error", Message = ex.Message }));
            }
        }
Exemplo n.º 8
0
        public async Task <ActionResult> Edit()
        {
            BrandingViewModel model = new BrandingViewModel();

            model.ResponseStatus = false;
            try
            {
                HttpResponseMessage response = await Get("Branding/GetAll");

                if (response.IsSuccessStatusCode)
                {
                    var responseContent = await response.Content.ReadAsAsync <SOBrandingDto>();

                    if (response.StatusCode == HttpStatusCode.OK && responseContent != null)
                    {
                        model = brandMapper.ToObject(responseContent);
                        model.ResponseStatus = true;
                    }
                }

                model.ResponseMsg = response.ReasonPhrase;
                response          = await Get("SPCurrency/GetAllCurrency");

                if (response.IsSuccessStatusCode)
                {
                    var responseContent = await response.Content.ReadAsAsync <List <SPCurrencyDto> >();

                    if (response.StatusCode == HttpStatusCode.OK && responseContent.Count() > 0)
                    {
                        model.BaseCurrencyList = responseContent.AsEnumerable().Select(s => new SelectListItem()
                        {
                            Text = s.Currency, Value = s.Id.ToString(), Selected = s.Id == model.BaseCurrencyID
                        });
                    }
                    else
                    {
                        model.BaseCurrencyList = new List <SelectListItem>();
                    }
                }
                else
                {
                    model.BaseCurrencyList = new List <SelectListItem>();
                }
            }
            catch (Exception ex)
            {
                logger.Error("Branding- Edit " + ex.Message);
            }

            return(View(model));
        }
        /// <summary>
        /// Gets all position parameters.
        /// </summary>
        /// <returns>returns list of POSParmeterCategoryModel.</returns>
        public async Task <ActionResult> GetAllPos()

        {
            try
            {
                List <POSViewModel> posList = new List <POSViewModel>();

                var responseParamCat = await Get("POSRegistration/GetAllPOS");

                var posListDto = await responseParamCat.Content.ReadAsAsync <List <POSDto> >();

                posList = posMapper.ToObjects(posListDto).ToList();

                List <SupplierViewModel> supplierList = new List <SupplierViewModel>();
                var supplierResponse = await Get("Supplier/GetAllSuppliers");

                var supplierListContent = await supplierResponse.Content.ReadAsAsync <IEnumerable <SupplierDto> >();

                supplierList = supplierMapper.ToObjects(supplierListContent).ToList();
                var listForRendering = SetPosViewModel(supplierList, posList);
                return(Json(new { Status = 1, Data = RenderRazorViewToString("_PosList", listForRendering) }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(null);
            }
        }
        public async Task <HttpResponseMessage> GetSPHierarchyById(int id)
        {
            try
            {
                var spHierarchy = await hierarchyService.GetSPHierarchyById(id);

                return(CreateHttpResponse <ISPHierarchy>(HttpStatusCode.OK, HttpCustomStatus.Success, spHierarchy, GetLocalisedString("msgSuccess")));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <ISPHierarchy>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, GetLocalisedString("msgWebServiceError")));
            }
        }
 /// <summary>
 /// Creates the SP role permission.
 /// </summary>
 /// <param name="rolePermission">The role permission.</param>
 /// <returns>ISP Role Permission</returns>
 public ISPRolePermission CreateRolePermission(ISPRolePermission rolePermission)
 {
     try
     {
         rolePermission.CreatedDate = DateTime.Now;
         rolePermission.EditedDate  = DateTime.Now;
         var item = sproleFeature.Add(rolePermission);
         UnitOfWork.Commit();
         return(item);
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         throw ex;
     }
 }
        /// <summary>
        /// Gets the product group list.
        /// </summary>
        /// <returns>The ActionResult</returns>
        public async Task <ActionResult> GetProductGroupList()
        {
            try
            {
                var productGroupList = await GetAllProductGroups();

                var serviceProviderList = await GetServiceProviderSelectList();

                productGroupList.ForEach(
                    x => x.ServiceProviderName = serviceProviderList
                                                 .Where(y => y.Value == x.ServiceProviderId.ToString())
                                                 .Select(y => y.Text)
                                                 .FirstOrDefault());
                return(Json(
                           new
                {
                    Status = 1,
                    Data = RenderRazorViewToString("_ProductGroupList", productGroupList),
                    Message = string.Empty
                },
                           JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(Json(new { Status = 0, Data = "error", Message = ex.Message }));
            }
        }
Exemplo n.º 13
0
 public async Task <HttpResponseMessage> GetAllCurrency()
 {
     try
     {
         var currencyList = (await currencyService.GetAllCurrency()).ToList();
         if (currencyList.Count == 0)
         {
             return(CreateHttpResponse <bool>(HttpStatusCode.NoContent, HttpCustomStatus.Success, false, null));
         }
         else
         {
             return(CreateHttpResponse <List <ISPCurrency> >(HttpStatusCode.OK, HttpCustomStatus.Success, currencyList, null));
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         return(CreateHttpResponse <bool>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, false, "Internal server error"));
     }
 }
Exemplo n.º 14
0
 public async Task <HttpResponseMessage> GetAll()
 {
     try
     {
         ISOBranding brandEntity = (await brandingSrv.GetAll()).FirstOrDefault();
         if (brandEntity != null)
         {
             var result = CreateHttpResponse <ISOBranding>(HttpStatusCode.OK, HttpCustomStatus.Success, brandEntity, "Success");
             return(result);
         }
         else
         {
             return(CreateHttpResponse <ISOBranding>(HttpStatusCode.NoContent, HttpCustomStatus.Success, null, "No Records Found"));
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         return(CreateHttpResponse <ISOBranding>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, "Web Service Error: Please report this problem or try again later." + ex.Message));
     }
 }
Exemplo n.º 15
0
 public async Task <HttpResponseMessage> GetAll()
 {
     try
     {
         var brandEntity = (await brandingSrv.GetAll()).FirstOrDefault();
         if (brandEntity != null)
         {
             var result = CreateHttpResponse <ISOBranding>(HttpStatusCode.OK, HttpCustomStatus.Success, brandEntity, GetLocalisedString("msgBrandingSuccess"));
             return(result);
         }
         else
         {
             return(CreateHttpResponse <ISOBranding>(HttpStatusCode.NoContent, HttpCustomStatus.Success, null, GetLocalisedString("msgNoRecord")));
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         return(CreateHttpResponse <ISOBranding>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, GetLocalisedString("msgWebServiceError") + ex.Message));
     }
 }
        public async Task <HttpResponseMessage> GetAll()
        {
            try
            {
                var result = await printTemplateSrv.GetAll();

                if (result != null)
                {
                    return(CreateHttpResponse <IEnumerable <ISPPrintTemplate> >(HttpStatusCode.OK, HttpCustomStatus.Success, result, "Success"));
                }
                else
                {
                    return(CreateHttpResponse <IEnumerable <ISPPrintTemplate> >(HttpStatusCode.NoContent, HttpCustomStatus.Success, result, "No Records Found"));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <IEnumerable <ISPPrintTemplate> >(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, "Web Service Error: Please report this problem or try again later." + ex.Message));
            }
        }
Exemplo n.º 17
0
        public async Task <HttpResponseMessage> GetAll()
        {
            try
            {
                var result = await printTemplateSrv.GetAll();

                if (result != null)
                {
                    return(CreateHttpResponse <IEnumerable <ISPPrintTemplate> >(HttpStatusCode.OK, HttpCustomStatus.Success, result, GetLocalisedString("msgSuccess")));
                }
                else
                {
                    return(CreateHttpResponse <IEnumerable <ISPPrintTemplate> >(HttpStatusCode.NoContent, HttpCustomStatus.Success, result, GetLocalisedString("msgNoRecord")));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <IEnumerable <ISPPrintTemplate> >(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, GetLocalisedString("msgWebServiceError") + ex.Message));
            }
        }
Exemplo n.º 18
0
        public HttpResponseMessage CreateAddress([ModelBinder(typeof(IocCustomCreationConverter))] ISPAddress address)
        {
            try
            {
                var createdAddress = addressService.CreateSPAddress(address);

                if (createdAddress == null)
                {
                    return(CreateHttpResponse <ISPAddress>(HttpStatusCode.BadRequest, HttpCustomStatus.Failure, address, GetLocalisedString("msgWebServiceError")));
                }
                else
                {
                    return(CreateHttpResponse <ISPAddress>(HttpStatusCode.Created, HttpCustomStatus.Success, address, GetLocalisedString("msgSPAddressCreation")));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <bool>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, false, GetLocalisedString("msgWebServiceError")));
            }
        }
        /// <summary>
        /// Gets the position parameters.
        /// </summary>
        /// <returns>returns pos_List partial view.</returns>
        public async Task <ActionResult> GetPosParameters()
        {
            try
            {
                var posList = await GetAllPosParameters();

                if (posList != null)
                {
                    return(Json(new { Status = 1, Data = RenderRazorViewToString("pos_List", posList) }));
                }

                return(Json(new { Status = 1, Data = RenderRazorViewToString("pos_List", posList) }));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(Json(new { Status = 0, Data = "error", Message = ex.Message }));
            }
        }
Exemplo n.º 20
0
        public async Task <HttpResponseMessage> GetAllSuppliers()
        {
            try
            {
                var supplierList = await supplierService.GetAllSuppliers();

                return(CreateHttpResponse <IEnumerable <ISupplier> >(HttpStatusCode.OK, HttpCustomStatus.Success, supplierList, GetLocalisedString("msgSuccess")));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <IEnumerable <ISupplier> >(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, GetLocalisedString("msgWebServiceError")));
            }
        }
        public async Task <HttpResponseMessage> GetAllPOSParameterCategories()
        {
            try
            {
                var posParamCategoryList = await posService.GetAllPOSParameterCategories();

                return(CreateHttpResponse <IEnumerable <IPOSParameterCategory> >(HttpStatusCode.OK, HttpCustomStatus.Success, posParamCategoryList, GetLocalisedString("msgSuccess")));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <IEnumerable <IPOSParameterCategory> >(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, GetLocalisedString("msgWebServiceError")));
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Loads the contact pop up.
        /// </summary>
        /// <param name="partnerId">The sosp identifier.</param>
        /// <returns>The view.</returns>
        public async Task <ActionResult> LoadContactPopUp(int partnerId)
        {
            try
            {
                var contactViewModel = new SOSolutionPartnerContactsViewModel();
                contactViewModel.ContactList = await GetContactsBySolutionPartner(partnerId);

                return(Json(new
                {
                    Status = 1,
                    Data = RenderRazorViewToString("_ContactList", contactViewModel),
                    Message = string.Empty
                }));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(Json(new
                {
                    Status = 0,
                    Message = "Something wrong!"
                }));
            }
        }
Exemplo n.º 23
0
 /// <summary>
 /// Creates the role.
 /// </summary>
 /// <param name="role">The role.</param>
 /// <returns>
 /// ISP Role
 /// </returns>
 public ISPRole CreateRole(ISPRole role)
 {
     try
     {
         var exists = roles.Entities
                      .Where(x => (x.RoleName.Trim().ToLower() == role.RoleName && x.HierarchyId == role.HierarchyId))
                      .Any();
         if (!exists)
         {
             var savedRole = roles.Add(role);
             UnitOfWork.Commit();
             return(savedRole);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         throw ex;
     }
 }
Exemplo n.º 24
0
        public async Task <HttpResponseMessage> GetRoles()
        {
            try
            {
                var collection = await roleService.GetAllRoles();

                return(CreateHttpResponse <IEnumerable <ISPRole> >(HttpStatusCode.OK, HttpCustomStatus.Success, collection, GetLocalisedString("msgSuccess")));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <IEnumerable <ISPRole> >(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, null, GetLocalisedString("msgWebServiceError")));
            }
        }
Exemplo n.º 25
0
 public HttpResponseMessage GetRoleByHierarchy([FromUri] int id)
 {
     try
     {
         var item = Task.Run(async() =>
         {
             return(await roleService.GetRoleByHierarchy(id));
         });
         var roles = item.Result;
         return(CreateHttpResponse <IEnumerable <ISPRole> >(
                    HttpStatusCode.OK, HttpCustomStatus.Success, roles, "Success."));
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         return(CreateHttpResponse <ISPRole>(HttpStatusCode.ExpectationFailed, HttpCustomStatus.Failure, null, "Web Service Error: Please report this problem or try again later."));
     }
 }
Exemplo n.º 26
0
        public HttpResponseMessage Create([ModelBinder(typeof(IocCustomCreationConverter))] ISPCategory categoryEntity)
        {
            {
                bool result = false;
                try
                {
                    result = categoryService.CreateCategory(categoryEntity);
                    if (!result)
                    {
                        return(CreateHttpResponse <ISPCategory>(HttpStatusCode.OK, HttpCustomStatus.Failure, null, GetLocalisedString("msgCategoryDuplicate")));
                    }

                    return(CreateHttpResponse <ISPCategory>(HttpStatusCode.Created, HttpCustomStatus.Success, null, GetLocalisedString("msgCategoryCreation")));
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                    return(CreateHttpResponse <ISPCategory>(HttpStatusCode.ExpectationFailed, HttpCustomStatus.Failure, null, GetLocalisedString("msgWebServiceError")));
                }
            }
        }
Exemplo n.º 27
0
        public async Task <HttpResponseMessage> CreateSolutionPartner([ModelBinder(typeof(IocCustomCreationConverter))] ISOSolutionPartner solutionPartner)
        {
            try
            {
                var solutionpartner = await solutionPartnerService.CreateSolutionPartner(solutionPartner);

                if (solutionpartner == null)
                {
                    return(CreateHttpResponse <ISOSolutionPartner>(HttpStatusCode.Created, HttpCustomStatus.Success, solutionpartner, GetLocalisedString("msgSolutionPartnerCreation")));
                }
                else
                {
                    return(CreateHttpResponse <ISOSolutionPartner>(HttpStatusCode.OK, HttpCustomStatus.Failure, solutionpartner, GetLocalisedString("msgUserDuplication")));
                }
            }

            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <bool>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, false, GetLocalisedString("msgWebServiceError")));
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Loads the category add popup.
        /// </summary>
        /// <returns>Action Result</returns>
        public async Task <ActionResult> LoadCategoryAddPopup()
        {
            try
            {
                List <SPCategoryViewModel> categoryList = new List <SPCategoryViewModel>();

                var responseCategories = await Get("SPCategory/GetAllCategories");

                if (responseCategories.StatusCode == HttpStatusCode.OK)
                {
                    var categories = await responseCategories.Content.ReadAsAsync <IEnumerable <SPCategoryDto> >();

                    categoryList = categoryMapper.ToObjects(categories).OrderBy(x => x.SortOrder).ToList();
                }

                return(Json(new { Status = 1, Data = RenderRazorViewToString("_AddPopUp", categoryList) }));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(Json(new { Status = 0, Data = "error", Message = ex.Message }));
            }
        }
        public HttpResponseMessage CreateCurrencyDescription([ModelBinder(typeof(IocCustomCreationConverter))] ISPCurrencyRate currency)
        {
            try
            {
                var currencyCreated = currencyRateService.CreateCurrency(currency);

                if (currencyCreated == null)
                {
                    return(CreateHttpResponse <bool>(HttpStatusCode.BadRequest, HttpCustomStatus.Failure, false, "Operation failed."));
                }
                else
                {
                    return(CreateHttpResponse <bool>(HttpStatusCode.Created, HttpCustomStatus.Success, true, "Currency created successfully."));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <bool>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, false, "Internal server error."));
            }
        }
Exemplo n.º 30
0
        public async Task <HttpResponseMessage> GetUser(int id)
        {
            try
            {
                var user = await ownerUserService.GetUserById(id);

                if (user != null)
                {
                    return(CreateHttpResponse <ISOUser>(HttpStatusCode.OK, HttpCustomStatus.Success, user, GetLocalisedString("msgSuccess")));
                }
                else
                {
                    return(CreateHttpResponse <ISOUser>(HttpStatusCode.BadRequest, HttpCustomStatus.Failure, user, GetLocalisedString("msgWebServiceError")));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <bool>(HttpStatusCode.InternalServerError, HttpCustomStatus.Failure, false, GetLocalisedString("msgWebServiceError")));
            }
        }