public async Task <IActionResult> Put(int userId, [FromBody] ImageResizeRequest request)
        {
            if (db.ImageResizeRequests.Any(b => b.UserId == userId))
            {
                db.Entry(request).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                await db.SaveChangesAsync();

                return(Ok());
            }
            db.ImageResizeRequests.Add(request);
            await db.SaveChangesAsync();

            string uri = String.Format(AppSettings.Url, "api/1.0.0/image-resize-requests/") + request.User.Id.ToString();

            return(Created(uri, request));
        }
Exemple #2
0
        public async Task <IActionResult> Put(long chatId, [FromBody] BotUser user)
        {
            if (db.BotUsers.Any(b => b.ChatId == chatId))
            {
                db.Entry(user).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                db.BotUsers.Update(user);
                await db.SaveChangesAsync();

                return(Ok());
            }
            db.BotUsers.Add(user);
            await db.SaveChangesAsync();

            string uri = String.Format(AppSettings.Url, "api/1.0.0/users/") + user.ChatId.ToString();

            return(Created(uri, user));
        }