Exemplo n.º 1
0
        public IHttpActionResult PostHomePic(HomePic homePic)
        {
            DALServiceGateway<HomePic> gate = new DALServiceGateway<HomePic>();

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            gate.PostItems("api/HomePics/",homePic);
            return CreatedAtRoute("DefaultApi", new { id = homePic.Id }, homePic);
        }
Exemplo n.º 2
0
        public IHttpActionResult PutHomePic(int id, HomePic homePic)
        {
            DALServiceGateway<HomePic> gate = new DALServiceGateway<HomePic>();

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != homePic.Id)
            {
                return BadRequest();
            }

            if (id != homePic.Id)
            {
                return BadRequest();
            }

                gate.PutItems("api/HomePics/"+id, homePic);

            return StatusCode(HttpStatusCode.NoContent);
        }
 public ActionResult Edit(HomePic hc)
 {
     BLLServiceGateway<HomePic> gate = new BLLServiceGateway<HomePic>();
     gate.PutItems("api/HomePic/" + hc.Id, hc);
     return RedirectToAction("Index");
 }
 public ActionResult Create(HomePic hc)
 {
     BLLServiceGateway<HomePic> gate = new BLLServiceGateway<HomePic>();
     gate.PostItems("api/HomePic/", hc);
     return RedirectToAction("Index");
 }