public ActionResult Register(DeviceRegisterRequest request, int? authuid, UserModel authUser) { request.AuthUid = authUser == null ? 0 : authUser.Id; request.AuthUser = authUser == null ? null : authUser; return new RestfulResult { Data = this._apnsDataService.Register(request) }; }
public ActionResult Create(CreateAddressRequest request, UserModel authUser) { if (!ModelState.IsValid) { var error = ModelState.Values.Where(v => v.Errors.Count() > 0).First(); return this.RenderError(r => r.Message = error.Errors.First().ErrorMessage); } var inserted = _shippingRepo.Insert(new ShippingAddressEntity() { ShippingAddress1 = request.ShippingAddress, ShippingCity = request.ShippingCity, ShippingCityId = request.ShippingCityId, ShippingContactPerson = request.ShippingContactPerson, ShippingContactPhone = request.ShippingContactPhone, ShippingProvince = request.ShippingProvince, ShippingProvinceId = request.ShippingProvinceId, ShippingZipCode = request.ShippingZipCode, ShippingDistrictId = request.ShippingDistrictId, ShippingDistrictName = request.ShippingDistrict, Status = (int)DataStatus.Normal, UpdateDate = DateTime.Now, UpdateUser = authUser.Id, UserId = authUser.Id }); return this.RenderSuccess<SelfAddressResponse>(R=>R.Data=new SelfAddressResponse().FromEntity<SelfAddressResponse>(inserted)); }
public ActionResult Detail(GetPointInfoRequest request, int? authuid, UserModel authUser) { request.AuthUid = authuid.Value; request.AuthUser = authUser; return new RestfulResult { Data = this._pointDataService.Get(request) }; }
public RestfulResult Destroy(FavoriteDestroyRequest request, int? authuid, UserModel authUser) { request.AuthUid = authuid.Value; request.AuthUser = authUser; return new RestfulResult { Data = this._favoriteDataService.Destroy(request) }; }
//[HttpPost] //public RestfulResult UnBind(BindingRequest request, int? authuid, UserModel authUser) //{ // request.AuthUser = authUser; // request.AuthUid = authuid.Value; // return new RestfulResult { Data = this._cardDataService.UnBinding(request) }; //} public RestfulResult Detail(GetCardInfoRequest request, int? authuid, UserModel authUser) { request.AuthUser = authUser; request.AuthUid = authuid.Value; return new RestfulResult { Data = this._cardDataService.GetInfo(request) }; }
/// <summary> /// return current user's all conversion window /// </summary> /// <param name="authUser"></param> /// <returns></returns> public ActionResult List(PagerInfoRequest request, UserModel authUser) { var linq = Context.Set<PMessageEntity>().Where(p => p.FromUser == authUser.Id) .GroupBy(p=>p.ToUser) .Select(p=>new {ToUser = p.Key,Id = p.Max(pid=>pid.Id)}) .Union(Context.Set<PMessageEntity>().Where(p => p.ToUser == authUser.Id) .GroupBy(p=>p.FromUser) .Select(p=>new {ToUser = p.Key,Id = p.Max(pid=>pid.Id)})) .GroupBy(p=>p.ToUser) .Select(p=>new {Id = p.Max(pid=>pid.Id)}); var linq2 = linq.Join(Context.Set<PMessageEntity>(),o=>o.Id,i=>i.Id,(o,i)=>i) .Join(Context.Set<UserEntity>(), o => o.FromUser, i => i.Id, (o, i) => new { M = o, F = i }) .Join(Context.Set<UserEntity>(), o => o.M.ToUser, i => i.Id, (o, i) => new { M = o.M, F = o.F, T = i }); int totalCount = linq2.Count(); int skipCount = request.Page > 0 ? (request.Page - 1) * request.Pagesize : 0; linq2 = linq2.OrderByDescending(c => c.M.Id).Skip(skipCount).Take(request.Pagesize); var responseData = linq2.ToList().Select(l=>new NewPMessageResponse().FromEntity<NewPMessageResponse>(l.M, c => { c.FromUserModel=new UserInfoResponse().FromEntity<UserInfoResponse>(l.F); c.ToUserModel = new UserInfoResponse().FromEntity<UserInfoResponse>(l.T); })); var response = new PagerInfoResponse<NewPMessageResponse>(request.PagerRequest, totalCount) { Items = responseData.ToList() }; return new RestfulResult { Data = new ExecuteResult<PagerInfoResponse<NewPMessageResponse>>(response) }; }
public RestfulResult Bind(BindingRequest request, int? authuid, UserModel authUser) { request.AuthUser = authUser; request.AuthUid = authuid.Value; return new RestfulResult { Data = _cardDataService.Binding(request) }; }
public RestfulResult Create(FeedbackCreateRequest request, int? authuid, UserModel authUser) { request.AuthUid = authuid.Value; request.AuthUser = authUser; request.Contact = UrlDecode(request.Contact); request.Content = UrlDecode(request.Content); return new RestfulResult { Data = this._feedbackDataService.Create(request) }; }
public RestfulResult My(MyOrderRequest request, UserModel authUser) { var dbContext = Context; var onGoStatus = new int[]{ (int)OrderStatus.Paid, (int)OrderStatus.PreparePack, (int)OrderStatus.Shipped, (int)OrderStatus.PassConfirmed }; var linq = Context.Set<OrderEntity>().Where(o=>o.CustomerId == authUser.Id); switch(request.Type) { case OrderRequestType.WaitForPay: linq = linq.Where(o => o.Status == (int)OrderStatus.Create); break; case OrderRequestType.OnGoing: linq = linq.Where(o => onGoStatus.Any(status => status == o.Status)); break; case OrderRequestType.Complete: linq = linq.Where(o=>o.Status==(int)OrderStatus.CustomerReceived || o.Status==(int)OrderStatus.CustomerRejected || o.Status == (int)OrderStatus.Complete); break; case OrderRequestType.Void: linq = linq.Where(o=>o.Status == (int)OrderStatus.Void || o.Status == (int)OrderStatus.RMAd); break; } var linq2 = linq.GroupJoin(dbContext.Set<OrderItemEntity>().Join(dbContext.Set<BrandEntity>(), o => o.BrandId, i => i.Id, (o, i) => new { OI=o,B=i}) .GroupJoin(dbContext.Set<ResourceEntity>().Where(r => r.SourceType == (int)SourceType.Product && r.Type == (int)ResourceType.Image), o => new { P = o.OI.ProductId, PC = o.OI.ColorValueId }, i => new { P = i.SourceId, PC = i.ColorId }, (o, i) => new { OI = o.OI,B=o.B, R = i.OrderByDescending(r => r.SortOrder).FirstOrDefault() }), o => o.OrderNo, i => i.OI.OrderNo, (o, i) => new { O = o, R =i }); int totalCount = linq2.Count(); int skipCount = request.Page > 0 ? (request.Page - 1) * request.Pagesize : 0; linq2 = linq2.OrderByDescending(l => l.O.CreateDate).Skip(skipCount).Take(request.Pagesize); var result = linq2.ToList().Select(l=>new MyOrderDetailResponse().FromEntity<MyOrderDetailResponse>(l.O,o=>{ if (l.R == null) return; o.Products = l.R.Select(oi => new MyOrderItemDetailResponse().FromEntity<MyOrderItemDetailResponse>(oi.OI, product => { product.ProductResource = new ResourceInfoResponse().FromEntity<ResourceInfoResponse>(oi.R); product.BrandName = oi.B.Name; product.Brand2Name = oi.B.EnglishName; })); })); var response = new PagerInfoResponse<MyOrderDetailResponse>(request.PagerRequest, totalCount) { Items = result.ToList() }; return new RestfulResult { Data = new ExecuteResult<PagerInfoResponse<MyOrderDetailResponse>>(response) }; }
public RestfulResult List(GetFavoriteListRequest request, int? authuid, UserModel authUser) { //判断当前被读取的收藏列表的USER,是否是达人or 店长 if (authUser == null) { return new RestfulResult { Data = new ExecuteResult { StatusCode = StatusCode.ClientError, Message = "user未找到" } }; } request.UserModel = authUser; return new RestfulResult { Data = this._favoriteDataService.GetFavoriteList(request) }; }
public RestfulResult Create(FormCollection formCollection, CreatePromotionRequest request, int? authuid, UserModel authUser) { request.AuthUid = authuid.Value; request.AuthUser = authUser; request.Files = Request.Files; request.Description = UrlDecode(request.Description); request.Name = UrlDecode(request.Name); var result = _promotionDataService.CreatePromotion(request); return new RestfulResult { Data = result }; }
public ActionResult Details(GetAddressDetailRequest request, UserModel authUser) { var linq = Context.Set<ShippingAddressEntity>() .Where(s => s.Id == request.Id && s.UserId == authUser.Id).FirstOrDefault(); if (linq == null) return this.RenderError(m => m.Message = "地址错误!"); var result = new SelfAddressResponse().FromEntity<SelfAddressResponse>(linq); return new RestfulResult() { Data = new ExecuteResult<SelfAddressResponse>(result) }; }
public RestfulResult My(UserModel authUser) { var linq = _customerRepo.Context.Set<ShippingAddressEntity>() .Where(s => s.Status != (int)DataStatus.Deleted && s.UserId == authUser.Id) .OrderByDescending(s => s.UpdateDate) .Take(10).ToList() .Select(s => new SelfAddressResponse().FromEntity<SelfAddressResponse>(s)); var response = new PagerInfoResponse<SelfAddressResponse>(new PagerRequest(), linq.Count()) { Items = linq.ToList() }; return new RestfulResult { Data = new ExecuteResult<PagerInfoResponse<SelfAddressResponse>>(response) }; }
public ActionResult My(GetFavorListRequest request, int? authuid, UserModel authUser) { if (!(new int[] { (int)SourceType.Product, (int)SourceType.Promotion }).Contains(request.SourceType)) { request.SourceType = (int)SourceType.Product; } var linq = Context.Set<FavoriteEntity>().Where(p => p.User_Id == authUser.Id && p.FavoriteSourceType == request.SourceType && p.Status != (int)DataStatus.Deleted); if (request.SourceType == (int)SourceType.Product) { var linq2 = linq.Join(Context.Set<ProductEntity>(), o => o.FavoriteSourceId, i => i.Id, (o, i) => new { P = i, F = o }) .GroupJoin(Context.Set<ResourceEntity>().Where(r => r.SourceType == (int)SourceType.Product && r.Type == (int)ResourceType.Image), o => o.P.Id, i => i.SourceId, (o, i) => new { P = o.P, F = o.F, R = i }); int totalCount = linq2.Count(); int skipCount = request.Page > 0 ? (request.Page - 1) * request.Pagesize : 0; linq2 = linq2.OrderByDescending(l => l.P.CreatedDate).Skip(skipCount).Take(request.Pagesize); return this.RenderSuccess<PagerInfoResponse<ProductInfoResponse>>(r => { r.Data = new PagerInfoResponse<ProductInfoResponse>(request.PagerRequest, totalCount) { Items = linq2.ToList().Select(l => new ProductInfoResponse().FromEntity<ProductInfoResponse>(l.P, p => { p.ResourceInfoResponses = l.R.OrderByDescending(pr => pr.SortOrder).Select(pr => new ResourceInfoResponse().FromEntity<ResourceInfoResponse>(pr)).ToList(); })).ToList() }; }); } else { var linq2 = linq.Join(Context.Set<PromotionEntity>(), o => o.FavoriteSourceId, i => i.Id, (o, i) => new { P = i, F = o }) .GroupJoin(Context.Set<ResourceEntity>().Where(r => r.SourceType == (int)SourceType.Promotion && r.Type == (int)ResourceType.Image), o => o.P.Id, i => i.SourceId, (o, i) => new { P = o.P, F = o.F, R = i }); int totalCount = linq2.Count(); int skipCount = request.Page > 0 ? (request.Page - 1) * request.Pagesize : 0; linq2 = linq2.OrderByDescending(l => l.P.CreatedDate).Skip(skipCount).Take(request.Pagesize); return this.RenderSuccess<PagerInfoResponse<PromotionInfoResponse>>(r => { r.Data = new PagerInfoResponse<PromotionInfoResponse>(request.PagerRequest, totalCount) { Items = linq2.ToList().Select(l => new PromotionInfoResponse().FromEntity<PromotionInfoResponse>(l.P, p => { p.ResourceInfoResponses = l.R.OrderByDescending(pr => pr.SortOrder).Select(pr => new ResourceInfoResponse().FromEntity<ResourceInfoResponse>(pr)).ToList(); })).ToList() }; }); } }
public RestfulResult Detail(UpdateCustomerRequest request, int? authuid, UserModel authUser) { request.AuthUid = authuid.Value; request.AuthUser = authUser; if (String.Compare(request.Method, DefineRestfulMethod.Update, StringComparison.OrdinalIgnoreCase) == 0) { //更新 return new RestfulResult { Data = this._customerService.Update(request) }; } var linq = _customerRepo.Get(u => u.Id == authUser.Id) .GroupJoin(_resourceRepo.Get(r => r.SourceType == (int)SourceType.CustomerThumbBackground), o => o.Id, i => i.SourceId, (o, i) => new { C = o, RB = i }) .GroupJoin(_useraccountRepo.Get(ua => ua.Status != (int)DataStatus.Deleted), o => o.C.Id, i => i.User_Id, (o, i) => new { C = o.C, RB = o.RB, UA = i }); var response = from l in linq.ToList() select new CustomerInfoResponse().FromEntity<CustomerInfoResponse>(l.C , c => { var bgThum = l.RB.FirstOrDefault(); if (bgThum != null) { c.BackgroundLogo_r = new ResourceInfoResponse().FromEntity<ResourceInfoResponse>(bgThum); } c.CountsFromEntity(l.UA); c.Token = SessionKeyHelper.Encrypt(authUser.Id.ToString(CultureInfo.InvariantCulture)); }); ; return new RestfulResult { Data = new ExecuteResult<CustomerInfoResponse>(response.FirstOrDefault()) }; }
public RestfulResult List(GetPromotionListRequest request, int? authuid, UserModel authUser) { request.Type = UrlDecode(request.Type); if (!String.IsNullOrEmpty(request.Type)) { if (request.Type.ToLower() == "refresh") { return Refresh(new GetPromotionListForRefresh { Lat = request.Lat, Lng = request.Lng, PageSize = request.Pagesize, RefreshTs = request.RefreshTs, Sort = request.Sort }); } } return new RestfulResult { Data = this._promotionDataService.GetPromotionList(request) }; }
/// <summary> /// create private message from current user to other user /// </summary> /// <param name="request"></param> /// <param name="authUser"></param> /// <returns></returns> public ActionResult Say(NewPMessageRequest request, UserModel authUser) { if (!ModelState.IsValid) { var error = ModelState.Values.Where(v => v.Errors.Count() > 0).First(); return this.RenderError(r => r.Message = error.Errors.First().ErrorMessage); } var messageEntity = _pmRepo.Insert(new PMessageEntity() { CreateDate = DateTime.Now, FromUser = authUser.Id, IsAuto = false, IsVoice = false, TextMsg = request.TextMsg, ToUser = request.ToUser }); return this.RenderSuccess<NewPMessageResponse>(r=>r.Data=new NewPMessageResponse().FromEntity<NewPMessageResponse>(messageEntity, m => { m.FromUserModel = new UserInfoResponse().FromEntity<UserInfoResponse>(Context.Set<UserEntity>().Where(u => u.Id == messageEntity.FromUser).FirstOrDefault()); m.ToUserModel = new UserInfoResponse().FromEntity<UserInfoResponse>(Context.Set<UserEntity>().Where(u => u.Id == messageEntity.ToUser).FirstOrDefault()); })); }
private ProductInfoResponse IsR(ProductInfoResponse response, UserModel currentAuthUser, int productId) { if (response == null || currentAuthUser == null) { return response; } //是否收藏 var favoriteEntity = _favoriteService.Get(currentAuthUser.Id, productId, SourceType.Product); if (favoriteEntity != null) { response.CurrentUserIsFavorited = true; } //是否获取过优惠码 var list = _couponService.Get(currentAuthUser.Id, productId, SourceType.Product); if (list != null && list.Count > 0) { response.CurrentUserIsReceived = true; } return response; }
public ActionResult OrderList(PagerInfoRequest request, UserModel authUser) { var dbContext = Context; var linq = Context.Set<OrderEntity>().Where(o => o.CustomerId == authUser.Id && o.Status == (int)OrderStatus.Shipped); var linq2 = linq.GroupJoin(dbContext.Set<OrderItemEntity>().Join(dbContext.Set<BrandEntity>(), o => o.BrandId, i => i.Id, (o, i) => new { OI = o, B = i }) .GroupJoin(dbContext.Set<ResourceEntity>().Where(r => r.SourceType == (int)SourceType.Product && r.Type == (int)ResourceType.Image), o => o.OI.ProductId, i => i.SourceId, (o, i) => new { OI = o.OI,B=o.B, R = i.OrderByDescending(r => r.SortOrder).FirstOrDefault() }), o => o.OrderNo, i => i.OI.OrderNo, (o, i) => new { O = o, R = i }) .GroupJoin(dbContext.Set<RMAEntity>(),o=>o.O.OrderNo,i=>i.OrderNo,(o,i)=>new {O=o.O,R=o.R,RMA=i}); int totalCount = linq2.Count(); int skipCount = request.Page > 0 ? (request.Page - 1) * request.Pagesize : 0; linq2 = linq2.OrderByDescending(l => l.O.CreateDate).Skip(skipCount).Take(request.Pagesize); var result = linq2.ToList().Select(l => new MyOrderDetailResponse().FromEntity<MyOrderDetailResponse>(l.O, o => { if (l.R == null) return; o.Products = l.R.Select(oi => new MyOrderItemDetailResponse().FromEntity<MyOrderItemDetailResponse>(oi.OI, product => { product.ProductResource = new ResourceInfoResponse().FromEntity<ResourceInfoResponse>(oi.R); product.BrandName = oi.B.Name; product.Brand2Name = oi.B.EnglishName; })); o.RMAs = l.RMA.Select(rma => new MyRMAResponse().FromEntity<MyRMAResponse>(rma)); })); var response = new PagerInfoResponse<MyOrderDetailResponse>(request.PagerRequest, totalCount) { Items = result.ToList() }; return this.RenderSuccess<PagerInfoResponse<MyOrderDetailResponse>>(r => r.Data = response); }
/// <summary> /// return request tag's available properties /// </summary> /// <param name="request"></param> /// <param name="authUser"></param> /// <returns></returns> public ActionResult Property(TagGetRequest request, UserModel authUser) { var linq = Context.Set<CategoryPropertyEntity>().Where(c => c.CategoryId == request.TagId && c.Status == (int)DataStatus.Normal) .GroupJoin(Context.Set<CategoryPropertyValueEntity>().Where(pv => pv.Status == (int)DataStatus.Normal), o => o.Id, i => i.PropertyId, (o, i) => new { P = o, PV = i }) .OrderByDescending(p => p.P.SortOrder); var result = linq.ToList() .Select(l => new TagPropertyDetailResponse().FromEntity<TagPropertyDetailResponse>(l.P, p => { p.PropertyId = l.P.Id; p.PropertyName = l.P.PropertyDesc; p.Values = l.PV.Select(pv => new TagPropertyValueDetailResponse() { ValueId = pv.Id, ValueName =pv.ValueDesc }); })); var response = new PagerInfoResponse<TagPropertyDetailResponse>(new PagerRequest(), result.Count()) { Items = result.ToList() }; return new RestfulResult { Data = new ExecuteResult<PagerInfoResponse<TagPropertyDetailResponse>>(response) }; }
public ActionResult Amount(ExchangeStoreCouponRuleRequest request, int? authuid, UserModel authUser) { request.AuthUser = authUser; var storepromotion = _storeproRepo.Get(sp => sp.Id == request.StorePromotionId && sp.ActiveStartDate <= DateTime.Now && sp.ActiveEndDate >= DateTime.Now).FirstOrDefault(); if (storepromotion == null) return new RestfulResult { Data = new ExecuteResult { StatusCode = StatusCode.InternalServerError, Message = "促销活动无效!" } }; if (storepromotion.MinPoints > request.Points) { return new RestfulResult { Data = new ExecuteResult { StatusCode = StatusCode.InternalServerError, Message = "兑换积点需大于最小积点限制!" } }; } return new RestfulResult { Data = new ExecuteResult<ExchangeStoreCouponRuleResponse>(new ExchangeStoreCouponRuleResponse() { Amount = StorePromotionRule.AmountFromPoints(request.StorePromotionId,request.Points) }) }; }
public ActionResult List(PagerInfoRequest request, UserModel authUser) { var linq = Context.Set<RMAEntity>().Where(r => r.UserId == authUser.Id) .GroupJoin(Context.Set<RMAItemEntity>() .GroupJoin(Context.Set<ResourceEntity>().Where(res => res.SourceType == (int)SourceType.Product && res.Type == (int)ResourceType.Image) , o => new { Product = o.ProductId, Color = o.ColorId } , i => new { Product = i.SourceId, Color = i.ColorId } , (o, i) => new { R = o, Res = i.OrderByDescending(res2 => res2.SortOrder).FirstOrDefault() }) .GroupJoin(Context.Set<BrandEntity>(), o => o.R.BrandId, i => i.Id, (o, i) => new { R=o.R,Res=o.Res,B=i.FirstOrDefault()}) , o => o.RMANo, i => i.R.RMANo, (o, i) => new { R = o, RI = i }); int totalCount = linq.Count(); int skipCount = request.Page > 0 ? (request.Page - 1) * request.Pagesize : 0; linq = linq.OrderByDescending(l => l.R.CreateDate).Skip(skipCount).Take(request.Pagesize); var result = linq.ToList().Select(l => new RMAInfoResponse().FromEntity<RMAInfoResponse>(l.R, o => { if (l.RI == null) return; o.CanVoid = RMARule.CanVoid(o.Status); o.Products = l.RI.ToList().Select(oi => new RMAItemInfoResponse().FromEntity<RMAItemInfoResponse>(oi.R, product => { product.ProductResource = new ResourceInfoResponse().FromEntity<ResourceInfoResponse>(oi.Res); if (oi.B != null) { product.BrandName = oi.B.Name; product.Brand2Name = oi.B.EnglishName; } })); })); var response = new PagerInfoResponse<RMAInfoResponse>(request.PagerRequest, totalCount) { Items = result.ToList() }; return this.RenderSuccess<PagerInfoResponse<RMAInfoResponse>>(r => r.Data = response); }
/// <summary> /// DTO 转换 /// </summary> /// <param name="source"></param> /// <returns></returns> public CustomerInfoResponse CustomerInfoResponseMapping(UserModel source) { if (source == null) { return null; } var target = Mapper.Map<UserModel, CustomerInfoResponse>(source); target.Token = GetToken(source); target.AppId = ConfigManager.GetAppleAppId(); return target; }
/// <summary> /// DTO 转换 重新获取COUNT 并且更新 ACCOUNT /// </summary> /// <param name="source"></param> /// <returns></returns> public CustomerInfoResponse CustomerInfoResponseMappingForReadCount(UserModel source) { if (source == null) { return null; } var target = Mapper.Map<UserModel, CustomerInfoResponse>(source); if (target == null) { return null; } //Read data //1.关注 //2.粉丝 //3.优惠券 //4.收藏的商品 //5.分享到外站的商品 //6.积点 var ilikeCount = _likeRepository.GetILikeCount(source.Id); var likeMeCount = _likeRepository.GetLikeMeCount(source.Id); var couponCount = _couponRepository.GetUserCouponCount(source.Id, CouponBusinessStatus.UnExpired); var favorCount = _favoriteRepository.GetUserFavorCount(source.Id, null); //var shareCount = //目前无扣分 有扣分时候再说 var pointSumZ = _pointRepository.GetUserPointSum(source.Id, new List<PointType> { PointType.BeConsumption, PointType.Default, PointType.InviteConsumption, PointType.Register, PointType.Reward }); var pointSumF = _pointRepository.GetUserPointSum(source.Id, new List<PointType> { PointType.Consumption }); //注意是否为负的可能 var pointSum = pointSumZ - pointSumF; if (target.ILikeCount != ilikeCount) { target.ILikeCount = ilikeCount; //up _userAccountRepository.SetAmount(source.Id, AccountType.IlikeCount, ilikeCount); } if (target.LikeMeCount != likeMeCount) { target.LikeMeCount = likeMeCount; _userAccountRepository.SetAmount(source.Id, AccountType.LikeMeCount, likeMeCount); } if (target.CouponCount != couponCount) { target.CouponCount = couponCount; _userAccountRepository.SetAmount(source.Id, AccountType.Coupon, couponCount); } if (target.FavorCount != favorCount) { target.FavorCount = favorCount; _userAccountRepository.SetAmount(source.Id, AccountType.FavorCount, favorCount); } if (target.PointCount != pointSum) { target.PointCount = pointSum; _userAccountRepository.SetAmount(source.Id, AccountType.Point, pointSum); } target.Token = GetToken(source); target.AppId = ConfigManager.GetAppleAppId(); return target; }
private string GetToken(UserModel userModel) { return SessionKeyHelper.Encrypt(userModel.Id.ToString(CultureInfo.InvariantCulture)); }
public ActionResult Create(PassCreateRequest request, int? authuid, UserModel authUser) { var result = this._couponDataService.Get(new CouponInfoGetRequest() { AuthUid = authuid.Value, CouponCode = request.CouponCode, CouponId = request.CouponId, Token = request.Token, AuthUser = authUser }); if (result.IsSuccess && result.Data != null) { return Coupon(ControllerContext, result.Data); } return new RestfulResult { Data = result }; }
public RestfulResult Portrait(PortraitRequest request, int? authuid, UserModel authUser) { request.AuthUid = authuid.Value; request.AuthUser = authUser; switch (request.Method.ToLower()) { case DefineRestfulMethod.Create: var r = new UploadLogoRequest(request) { Files = Request.Files }; return new RestfulResult { Data = this._customerService.UploadLogo(r) }; case DefineRestfulMethod.Destroy: var d = new DestroyLogoRequest(request); return new RestfulResult { Data = this._customerService.DestroyLogo(d) }; } return new RestfulResult { Data = new ExecuteResult { StatusCode = StatusCode.ClientError, Message = "参数错误" } }; }
public ShowCustomerInfoResponse ShowCustomerInfoResponseMapping(UserModel source) { var target = Mapper.Map<UserModel, ShowCustomerInfoResponse>(source); return target; }
public UserEntity UserEntityMapping(UserModel source) { if (source == null) { return null; } var target = Mapper.Map<UserModel, UserEntity>(source); return CheckUserEntity(target); }
public RestfulResult Favor(FormCollection formCollection, PromotionFavorCreateRequest request, int? authuid, UserModel authUser) { request.AuthUid = authuid.Value; request.AuthUser = authUser; if (System.String.Compare(request.Method, DefineRestfulMethod.Destroy, System.StringComparison.OrdinalIgnoreCase) == 0) { return new RestfulResult { Data = this._promotionDataService.DestroyFavor(new PromotionFavorDestroyRequest(request)) }; } //default if (String.IsNullOrWhiteSpace(request.Method)) { return new RestfulResult { Data = this._promotionDataService.CreateFavor(new PromotionFavorCreateRequest(request)) }; } return new RestfulResult() { Data = new ExecuteResult() { StatusCode = StatusCode.ClientError, Message = "方法错误" } }; }