public IHttpActionResult PostRloe(Rloe rloe) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } rloe.CreateTime = DateTime.Now; _rloerepository.Insert(rloe); return(CreatedAtRoute("DefaultApi", new { id = rloe.Id }, rloe)); }
public IHttpActionResult GetRloe(int id) { Rloe rloe = _rloerepository.Get(id); if (rloe == null) { return(NotFound()); } return(Ok(rloe)); }
public IHttpActionResult PutRloe(int id, Rloe rloe) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != rloe.Id) { return(BadRequest()); } try { _rloerepository.Update(rloe, id); } catch (Exception e) { throw e; } return(StatusCode(HttpStatusCode.NoContent)); }