Beispiel #1
0
        // PUT: api/band/5
        public IHttpActionResult Put([FromBody] Band value)
        {
            Band band;

            band = bandRepository.UpdateBand(value);
            if (band != null)
            {
                return(Ok(band));
            }

            return(BadRequest());
        }
Beispiel #2
0
        public ActionResult Put([FromBody] Band value)
        {
            Band band;

            band = bandRepository.UpdateBand(value);
            if (band != null)
            {
                return(StatusCode((int)HttpStatusCode.Accepted, band));
            }

            return(BadRequest());
        }
Beispiel #3
0
        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);
        }