public ActionResult Post([FromBody] Band value) { Band band; band = bandRepository.AddBand(value); if (band != null) { return(StatusCode((int)HttpStatusCode.Created, band)); } return(BadRequest()); }
// POST: api/band public IHttpActionResult Post([FromBody] Band value) { Band band; band = bandRepository.AddBand(value); if (band != null) { return(Ok(band)); } return(BadRequest()); }
public ActionResult CreateBand(AdminBand adminBand) { if (ModelState.IsValid) { var filename = CreateFileName(adminBand.Band.Name); var path = Path.Combine(Server.MapPath(bandImagePath), filename); adminBand.Band.ImagePath = bandImagePath + filename; Image sourceimage = Image.FromStream(adminBand.File.InputStream); sourceimage.Save(path, ImageFormat.Jpeg); bandRepository.AddBand(adminBand.Band); } else { ModelState.AddModelError("Error", "One or more Fields were empty."); } var adminEventEditViewModel = (AdminEventEditViewModel)Session["adminEventEditViewModel"]; adminEventEditViewModel.AdminBand = adminBand; Session["adminEventEditViewModel"] = adminEventEditViewModel; return(RedirectToAction("AdminEventEdit")); }
public HttpResponseMessage Post(NewBandBindingModel newBand) { _bandRepository.AddBand(newBand); return(Request.CreateResponse(HttpStatusCode.OK)); }