Exemplo n.º 1
0
        public IHttpActionResult GetOfficer(string name)
        {
            try
            {
                OfficerViewModel officerVM = new OfficerViewModel();
                Officer          officer   = _common.GetOfficer(name);

                if (officer != null)
                {
                    officerVM.id   = officer.ID;
                    officerVM.name = officer.Name;
                    officerVM.nic  = officer.NIC;
                }

                var messageData  = new { code = Constant.SuccessMessageCode, message = Constant.MessageSuccess };
                var returnObject = new { officer = officerVM, messageCode = messageData };
                return(Ok(returnObject));
            }
            catch (Exception ex)
            {
                string errorLogId   = _eventLog.WriteLogs(User.Identity.Name, ex, MethodBase.GetCurrentMethod().Name);
                var    messageData  = new { code = Constant.ErrorMessageCode, message = String.Format(Constant.MessageTaskmateError, errorLogId) };
                var    returnObject = new { messageCode = messageData };
                return(Ok(returnObject));
            }
        }