예제 #1
0
        public ActionResult AddData(GuideAddModel model)
        {
            model.OTABusinessId = UserInfo.OtaBusinessId;
            var result = _guideFacadeService.Add(model);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public TResult Add(GuideAddModel model)
        {
            var result = new TResult();

            _travelAgencyGuideRepository.Add(new Tbl_TravelAgencyGuides
            {
                EnterpriseId  = model.EnterpriseId,
                ScenicId      = model.ScenicId,
                OTABusinessId = model.OTABusinessId,
                Name          = model.Name,
                Mobile        = model.Mobile,
                IdCard        = model.IdCard,
                GuideType     = model.GuideType,
                CreateTime    = DateTime.Now
            });
            return(result.SuccessResult());
        }
예제 #3
0
        public ActionResult Add(GuideAddModel model)
        {
            if (!ModelState.IsValid)
            {
                string msg = mvchelper.GetValiMsg(ModelState);
                return(Json(new AjaxResult {
                    status = "error", errorMsg = msg
                }));
            }
            //服务器端的校验必不可少
            bool exists = UserSvc.GetByAccount(model.account) != null;

            if (!exists)
            {
                return(Json(new AjaxResult
                {
                    status = "error",
                    errorMsg = "该游客不存在"
                }));
            }

            using (TransactionScope ts = new TransactionScope())
            {
                var  user    = UserSvc.GetByAccount(model.account);
                long guideId = GuideSvc.AddGuide(user.Id, model.school, model.schoolnum, model.picture, model.intro);
                bool isok    = GuideUserSvc.appointment(guideId, user.Id);
                if (isok)
                {
                    ts.Complete();
                    return(Json(new AjaxResult {
                        status = "ok"
                    }));
                }
                else
                {
                    return(Json(new AjaxResult {
                        status = "error"
                    }));
                }
            }

            //roleService.AddRoleIds(userId, model.RoleIds);
        }
예제 #4
0
 public TResult Add(GuideAddModel model)
 {
     return(_travelAgencyGuideService.Add(model));
 }