public async Task <IActionResult> Upload() { try { var file = Request.Form.Files[0]; if (file.Length > 0 && file.ContentType.Contains("image")) { using (var stream = new MemoryStream()) { file.CopyTo(stream); var bytes = stream.ToArray(); var image = new MongoImage { Data = bytes, FileType = file.ContentType }; var img = await cont.Create(image); return(Ok(img._id.ToString())); } } else { return(BadRequest()); } } catch (Exception ex) { return(StatusCode(500, "Internal server error")); } }
public async Task <IActionResult> Post([FromBody] SearchParameter value) { return(Ok(await cont.Create(value))); }
public async Task <IActionResult> Post([FromBody] Role value) { return(Ok(await cont.Create(value))); }
public async Task <IActionResult> Post([FromBody] SystemSetting value) { return(Ok(await cont.Create(value))); }