public FIN_ApproveCashAdvanceModel Post([Bind] FIN_ApproveCashAdvanceModel model)
        {
            #region Validate

            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <FIN_ApproveCashAdvanceModel>(model, "FIN_ApproveCashAdvance", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }

            #endregion
            ActionService service = new ActionService(UserLogin);
            if (!string.IsNullOrEmpty(model.Other))
            {
                model.IsEntertaiment  = null;
                model.TravelRequestID = null;
            }
            if (model.IsEntertaiment == true)
            {
                model.TravelRequestID = null;
            }

            return(service.UpdateOrCreate <Fin_ApproveCashAdvanceEntity, FIN_ApproveCashAdvanceModel>(model));
        }
 public ActionResult Create(FIN_ApproveCashAdvanceModel model)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <FIN_ApproveCashAdvanceModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/FIN_ApproveCashAdvance/", model);
     }
     return(View());
 }
        public FIN_ApproveCashAdvanceModel GetById(Guid id)
        {
            string        status  = string.Empty;
            var           model   = new FIN_ApproveCashAdvanceModel();
            ActionService service = new ActionService(UserLogin);
            var           entity  = service.GetByIdUseStore <Fin_ApproveCashAdvanceEntity>(id, ConstantSql.hrm_hr_sp_get_CashAdvanceById, ref status);

            if (entity != null)
            {
                model = entity.CopyData <FIN_ApproveCashAdvanceModel>();
                if (model.TravelRequestID != null)
                {
                    model.IsTravelRequest = true;
                }
                if (!string.IsNullOrEmpty(model.Other))
                {
                    model.IsOther = true;
                }
            }
            model.ActionStatus = status;
            return(model);
        }