public async Task <ActionResult <string> > PostComments(Comments comments) { try { _context.Comments.Add(comments); await _context.SaveChangesAsync(); return(Ok("Comment Added")); } catch { return(BadRequest("Unable to comment, Try again later")); } }
public async Task <ActionResult <string> > PostPosts(Posts posts) { try { _context.Posts.Add(posts); await _context.SaveChangesAsync(); return(Ok("Posted Successfully")); } catch { return(BadRequest("Unable to post, Try again later")); } }
public async Task <ActionResult <string> > PostMessages(Messages messages) { try { _context.Messages.Add(messages); await _context.SaveChangesAsync(); return(Ok("Message Sent")); } catch { return(BadRequest("Message unable to be sent, Try again later")); } }
public async Task<ActionResult<string>> PostUsers(Users users) { var user = await _context.Users.Where(e => e.Id == users.Id).FirstAsync(); if (user != null) { user.Nickname = users.Nickname; user.Pword = users.Pword; await _context.SaveChangesAsync(); return Ok("User Info Changed"); } else return NotFound("User Info unable to be changed, Try again later"); }
public async Task <ActionResult <string> > PostSettings(Settings settings) { var currentSettings = await _context.Settings.Where(e => e.Id == settings.Id).FirstAsync(); if (currentSettings != null) { currentSettings.AppTheme = settings.AppTheme; await _context.SaveChangesAsync(); return(Ok("Settings Updated successfully")); } else { return(BadRequest("Settings unable to be updated")); } }