コード例 #1
0
ファイル: CarController.cs プロジェクト: d-moos/CarRental
        public ActionResult Put(Guid id, Car value)
        {
            if (!repo.Update(id, value))
            {
                return new HttpStatusCodeResult(422); // Unprocessable Entity -> Validation Error
            }

            return Ok();
        }
コード例 #2
0
ファイル: CarController.cs プロジェクト: d-moos/CarRental
 public ActionResult Post(Car value)
 {
     var newEntity = repo.Add(value);    // Create entity in DB
     return Created(String.Format("{0}{1}", Request.GetUri(), newEntity.Id), newEntity); // Return OK Header with Entity Location
 }