示例#1
0
        public virtual IActionResult Enter_Contribution([FromBody] Contribution model)
        {
            if (!ModelState.IsValid)
            {
                var error = ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage;
                return(BadRequest(new { error_occured = true, error_message = error }));
            }

            int userId = Convert.ToInt32(HttpContext.User.Claims
                                         .Where(w => w.Type == "UserId")
                                         .Select(x => x.Value)
                                         .FirstOrDefault());

            _imisModules.GetInsureeModule().GetFamilyLogic().SetUserId(userId);

            var response = _imisModules.GetInsureeModule().GetContributionLogic().Enter(model);

            return(Json(response));
        }
        public IActionResult Get(string chfid)
        {
            GetInsureeModel getInsureeModel;

            try
            {
                getInsureeModel = _imisModules.GetInsureeModule().GetInsureeLogic().Get(chfid);
            }
            catch (ValidationException e)
            {
                return(BadRequest(new { error = new { message = e.Message, value = e.Value } }));
            }

            if (getInsureeModel == null)
            {
                return(NotFound());
            }

            return(Ok(getInsureeModel));
        }
        public IActionResult Get(string chfid)
        {
            GetInsureeModel getInsureeModel;

            try
            {
                getInsureeModel = _imisModules.GetInsureeModule().GetInsureeLogic().Get(chfid);
            }
            catch (ValidationException e)
            {
                throw new BusinessException(e.Message);
            }

            if (getInsureeModel == null)
            {
                return(NotFound());
            }

            return(Ok(getInsureeModel));
        }
示例#4
0
        public IActionResult GetByCHFID(string chfid)
        {
            FamilyModel familyModel = new FamilyModel();

            try
            {
                Guid userUUID = Guid.Parse(HttpContext.User.Claims.Where(w => w.Type == "UserUUID").Select(x => x.Value).FirstOrDefault());
                familyModel = _imisModules.GetInsureeModule().GetFamilyLogic().GetByCHFID(chfid, userUUID);
            }
            catch (ValidationException e)
            {
                throw new BusinessException(e.Message);
            }

            if (familyModel == null)
            {
                return(NotFound());
            }

            return(Ok(familyModel));
        }
示例#5
0
        public IActionResult Get(string insureeNumber)
        {
            DataMessage response;

            try
            {
                if (insureeNumber != null || insureeNumber.Length != 0)
                {
                    var data = _imisModules.GetInsureeModule().GetFamilyLogic().Get(insureeNumber);

                    if (data.Count > 0)
                    {
                        response = new GetFamilyResponse(0, false, data, 0).Message;
                    }
                    else
                    {
                        response = new GetFamilyResponse(2, false, 0).Message;
                    }
                }
                else
                {
                    response = new GetFamilyResponse(1, true, 0).Message;
                }
            }
            catch (Exception e)
            {
                response = new GetFamilyResponse(e).Message;
            }

            return(Json(response));
        }