Exemple #1
0
        public PublishOfferResult PublishOffer(long offerId)
        {
            var result = BloodSearchModelsRemoteProvider.GetUserByContext(HttpContext.Current);

            if (!result.Success)
            {
                return(new PublishOfferResult {
                    Success = result.Success,
                    ErrMessages = result.ErrMessages.Select(_ => new KeyValuePair <string, string>(_.Key.ToString(), _.Message)).ToList()
                });
            }

            var publishOfferResult = BloodSearchModelsRemoteProvider.PublishOffer(new PublishOfferModel()
            {
                OfferId = offerId,
                UserId  = result.Id,
                IsAdmin = User.IsAdmin
            });

            if (!publishOfferResult.Success)
            {
                return(new PublishOfferResult {
                    Success = publishOfferResult.Success,
                    ErrMessages = publishOfferResult.ErrMessages
                });
            }

            return(publishOfferResult);
        }
Exemple #2
0
        public DeleteOfferResult DeleteOffer(long offerId)
        {
            var result = BloodSearchModelsRemoteProvider.GetUserByContext(HttpContext.Current);

            if (!result.Success)
            {
                return(new DeleteOfferResult {
                    Success = result.Success,
                    ErrMessages = result.ErrMessages.Select(x => new KeyValuePair <string, string>(x.Key.ToString(), x.Message)).ToList()
                });
            }

            var deleteOfferResult = BloodSearchModelsRemoteProvider.DeleteOffer(new DeleteOfferModel {
                OfferId = offerId,
                UserId  = result.Id,
                IsAdmin = User.IsAdmin
            });

            if (!deleteOfferResult.Success)
            {
                return(new DeleteOfferResult {
                    Success = deleteOfferResult.Success,
                    ErrMessages = deleteOfferResult.ErrMessages
                });
            }

            return(deleteOfferResult);
        }
Exemple #3
0
        public BaseResponse UpdateProfileInfo(ProfileViewModel request)
        {
            var user = BloodSearchModelsRemoteProvider.GetUserByContext(HttpContext.Current);

            if (!user.Success)
            {
                return(new BaseResponse()
                {
                    Success = false,
                    ErrMessages = user.ErrMessages
                });
            }

            var result = BloodSearchModelsRemoteProvider.EditUser(new EditUserRequest()
            {
                Token  = Token,
                Name   = request.Name,
                UserId = UserId,
                Phone  = request.Phone
            });

            return(result);
        }