UsersResource

We found 10 examples in language CSharp for this search. You will see 22 fragments of code.

        public async Task SetResource(int resource, string userId)
        {
            UsersResource usersResource = new UsersResource
            {
                UserId = userId,
                Krama = resource,
                Money = resource,
            };
            _db.UsersResources.Add(usersResource);
            await _db.SaveChangesAsync();
        }

        public async Task<UsersResource> FindResource(string userId)
        {
            return await _db.UsersResources.FirstOrDefaultAsync(resource => resource.UserId == userId);
        }

        public async Task AddKrama(int krama, string userId)
        {
            UsersResource resource = await _db.UsersResources
                                              .FirstOrDefaultAsync(resource => resource.UserId == userId);
            resource.Krama += krama;
            _db.UsersResources.Update(resource);
            await _db.SaveChangesAsync();
        }

        public async Task AddMoney(int money, string userId)
        {
            UsersResource resource = await _db.UsersResources
                                              .FirstOrDefaultAsync(resource => resource.UserId == userId);
            resource.Money += money;
            _db.UsersResources.Update(resource);
            await _db.SaveChangesAsync();
        }

        public async Task SubtrackKrama(int krama, string userId)
        {
            UsersResource resource = await _db.UsersResources
                                              .FirstOrDefaultAsync(resource => resource.UserId == userId);
            resource.Krama -= krama;
            _db.UsersResources.Update(resource);
            await _db.SaveChangesAsync();
        }

        public async Task SubtrackMoney(int money, string userId)
        {
            UsersResource resource = await _db.UsersResources
                                              .FirstOrDefaultAsync(resource => resource.UserId == userId);
            resource.Money -= money;
            _db.UsersResources.Update(resource);
            await _db.SaveChangesAsync();
        }


        // GET: api/Users/id
        [HttpGet("API/{id}")]
        public async Task<UsersResource> GetUsersAsyncById(int id)
        {
            var users = await _usersService.GetAsyncById(id);
            var usersResources = _mapper.Map<Users, UsersResource>(users);
            return usersResources;
        }


        // GET: api/Users/id
        [HttpGet("API/{id}")]
        public async Task<UsersResource> GetUsersAsyncById(int id)
        {
            var users = await _usersService.GetAsyncById(id);
            var usersResources = _mapper.Map<Users, UsersResource>(users);
            return usersResources;
        }


        public static IList<Message> GetMessageList()
        {
            var service = Connection.GetGmailService();
            UsersResource.MessagesResource.ListRequest messageRequest = service.Users.Messages.List("me");
            IList<Message> messages = messageRequest.Execute().Messages; //Unhandled System.Net.Http.HttpRequestException
            return messages;
        }

        public static IList<MessagePartHeader> GetMessageHeaders(UsersResource.MessagesResource.GetRequest req)
        {
            return req.Execute().Payload.Headers;
        }

        public static string GetMessageBodyPlain(UsersResource.MessagesResource.GetRequest req)
        {
            // The "clever" solution
            return Base64Translator.Base64UrlDecode(req.Execute().Payload.Parts[0].Body.Data);
        }

        public static string GetMessageSnippet(UsersResource.MessagesResource.GetRequest req)
        {
            return req.Execute().Snippet.Replace("&#39;", "\'");
        }


        public List<ChatMsg> GetMessages()
        {
            DateTime time = DateTime.Now.ToUniversalTime();
            time=time.AddDays(-2);

            return MapObject.MapObjList<Resources.Contract.Model.ChatMsg,ChatMsg>(usersResource.GetChatMsgHistory(time));
        }

        public void PostMessage(ChatMsg message)
        {
            message.Id = Guid.NewGuid().ToString();
            message.DateTime = message.DateTime.ToUniversalTime();

            usersResource.PostUserChatMessage(MapObject.MapObj<ChatMsg, Resources.Contract.Model.ChatMsg>(message));
        }


        public async Task<string> GetCount(string userId,string labelId)
        {
            await AuthenticateAsync();
            UsersResource.MessagesResource.ListRequest request = service.Users.Messages.List(userId);
            request.LabelIds = labelId;
            try
            {
                var response = request.Execute();
                return response.ResultSizeEstimate.ToString();
            }
            catch { return null; }
        }


        public void AddUser(string email, string password)
        {
            var vcapJsonRequest = BuildVcapJsonRequest(Method.POST, Constants.UsersResource);
            vcapJsonRequest.AddBody(new {email, password});
            vcapJsonRequest.Execute();
        }

        public VcapUser GetUser(string email)
        {
            var vcapJsonRequest = BuildVcapJsonRequest(Method.GET, Constants.UsersResource, email);
            return vcapJsonRequest.Execute<VcapUser>();
        }

        public IEnumerable<VcapUser> GetUsers()
        {
            var vcapJsonRequest = BuildVcapJsonRequest(Method.GET, Constants.UsersResource);
            return vcapJsonRequest.Execute<VcapUser[]>();
        }


        public async Task<Profile> GetProfile()
        {
            UsersResource.GetProfileRequest request = gmail.Users.GetProfile("me");

            return await request.ExecuteAsync();
        }

        public async Task<ListThreadsResponse> GetThreads()
        {
            UsersResource.ThreadsResource.ListRequest request = gmail.Users.Threads.List("me");

            return await request.ExecuteAsync();
        }

using Ewk.SoundCloud.ApiLibrary.Entities;

namespace Ewk.SoundCloud.ApiLibrary.Resources.Users
{
    class UsersResource : EntitiesResourceBase<User, IUserResources<User>>
    {
        private const string RelativePathFormat = "/users";

        #region Constructors

        public UsersResource(ISoundCloudClient soundCloudClient)
            : base(soundCloudClient, RelativePathFormat)
        {
        }

        public UsersResource(ISoundCloudClient soundCloudClient, string relativePath)
            : base(soundCloudClient, string.Concat(relativePath, RelativePathFormat))
        {
        }

        #endregion

        #region Overrides of EntitiesResourceBase<User,IUserResources>

        public override IUserResources<User> this[string id]
        {
            get { return new UserResources(SoundCloudClient, RelativePath, id); }
        }

        #endregion
    }
}

using Ewk.SoundCloud.ApiLibrary.Entities;

namespace Ewk.SoundCloud.ApiLibrary.Resources.Users
{
    class UsersResource : EntitiesResourceBase<User, IUserResources<User>>
    {
        private const string RelativePathFormat = "/users";

        #region Constructors

        public UsersResource(ISoundCloudClient soundCloudClient)
            : base(soundCloudClient, RelativePathFormat)
        {
        }

        public UsersResource(ISoundCloudClient soundCloudClient, string relativePath)
            : base(soundCloudClient, string.Concat(relativePath, RelativePathFormat))
        {
        }

        #endregion

        #region Overrides of EntitiesResourceBase<User,IUserResources>

        public override IUserResources<User> this[string id]
        {
            get { return new UserResources(SoundCloudClient, RelativePath, id); }
        }

        #endregion
    }
}

Google.Apis.AndroidPublisher.v3.UsersResource : Object

Constructors :

public UsersResource(IClientService service = )

Methods :

public CreateRequest Create(User body = , String parent = )
public DeleteRequest Delete(String name = )
public ListRequest List(String parent = )
public PatchRequest Patch(User body = , String name = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()