public IHttpActionResult PutClient(Guid id, ClientUpdate client) { if (!ModelState.IsValid) return BadRequest(ModelState); if (id != client.Id) return BadRequest(); repo_.Update(client); repo_.AddClientNote(id, NewNote.Log("Updated details")); return GetClient(id); } // PutClient
} // updateClient protected override Client addClientNote(Client client, string note) { return(repo_.AddClientNote(client.Id, new NewNote() { Text = note })); } // addClientNote
public async Task <IHttpActionResult> FileUpload(Guid id) { if (!Request.Content.IsMimeMultipartContent()) { return(BadRequest()); } var provider = GetMultipartProvider(); var result = await Request.Content.ReadAsMultipartAsync(provider); var fileData = result.FileData.First(); var fileName = fileData.Headers.ContentDisposition.FileName; fileName = fileName.Replace("\"", "").Replace("'", ""); var note = NewNote.FileUpload(fileName); await saveUpload(id, note.Id, fileData); repo_.AddClientNote(id, note); return(GetClient(id)); } // FileUpload