/// <summary> /// Creates the specified photo. /// </summary> /// <param name="photo">The photo.</param> /// <returns>Task<Photo>.</returns> public async Task<int> Create(Photo photo) { using (ChePingContext db = new ChePingContext()) { photo.UploadTime = DateTime.UtcNow.AddHours(8); await db.SaveAsync(photo); } return photo.Id; }
public async Task<IHttpActionResult> Create(AddPhotoRequest request) { Photo photo = new Photo { CaseId = request.CaseId, Content = request.Content, UploadTime = DateTime.UtcNow.AddHours(8) }; int id = await this.photoService.Create(photo); return this.Ok(new IntResponse { Result = id }); }