// PUT: api/band/5 public IHttpActionResult Put([FromBody] Band value) { Band band; band = bandRepository.UpdateBand(value); if (band != null) { return(Ok(band)); } return(BadRequest()); }
public ActionResult Put([FromBody] Band value) { Band band; band = bandRepository.UpdateBand(value); if (band != null) { return(StatusCode((int)HttpStatusCode.Accepted, band)); } return(BadRequest()); }
public void UpdateBand(int bandId, string name, string description, bool imageChanged) { Band oldBand = bandRepository.GetBand(bandId); if (oldBand.Name != name && !imageChanged) { System.IO.File.Move(Path.Combine(Server.MapPath(bandImagePath), CreateFileName(oldBand.Name)), Path.Combine(Server.MapPath(bandImagePath), CreateFileName(name))); } Band band = new Band() { Id = bandId, Name = name, Description = description, ImagePath = bandImagePath + CreateFileName(name) }; bandRepository.UpdateBand(band); }