Example #1
0
        //Get
        public ActionResult Search()
        {
            IntranetStaffProtectionVM model = new IntranetStaffProtectionVM();

            model.StaffProtectionList = new IntranetStaffProtectionModel();

            return(View(model));
        }
Example #2
0
        public ActionResult Search(string nino)
        {
            IntranetStaffProtectionVM model = new IntranetStaffProtectionVM();

            if (ModelState.IsValid)
            {
                model.NINO = nino;

                // Create service instance
                IUcbService sc = UcbService;

                // Create model

                try
                {
                    IntranetStaffProtectionResult response = sc.IntranetStaffProtection(CurrentUser, CurrentUser, appID, "", model.NINO);

                    // Close service communication
                    ((ICommunicationObject)sc).Close();

                    //Map response back to view model
                    model.StaffProtectionList = Mapper.Map <IntranetStaffProtectionResult, IntranetStaffProtectionModel>(response);


                    if (response.ControlMeasures == null)
                    {
                        model.Message = Resources.LABEL_ISP_No_data_found;
                    }

                    return(View(model));
                }
                catch (Exception e)
                {
                    // Handle the exception
                    string message = ExceptionManager.HandleException(e, (ICommunicationObject)sc);
                    model.Message = message;
                }
            }
            return(View(model));
        }