Esempio n. 1
0
        public ActionResult Post([FromBody] Band value)
        {
            Band band;

            band = bandRepository.AddBand(value);
            if (band != null)
            {
                return(StatusCode((int)HttpStatusCode.Created, band));
            }
            return(BadRequest());
        }
Esempio n. 2
0
        // POST: api/band
        public IHttpActionResult Post([FromBody] Band value)
        {
            Band band;

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

            return(BadRequest());
        }
Esempio n. 3
0
        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"));
        }
Esempio n. 4
0
 public HttpResponseMessage Post(NewBandBindingModel newBand)
 {
     _bandRepository.AddBand(newBand);
     return(Request.CreateResponse(HttpStatusCode.OK));
 }