public RectangleDetail Insert(RectangleDetail detail) { var shape = FromJson(detail); shape.Save(); return(ToJson(shape)); }
static RectangleShape FromJson(RectangleDetail detail) { var shape = RectangleShape.GetById(detail.Id) ?? new RectangleShape(); shape.Id = detail.Id; shape.Color = detail.Color; return(shape); }
public IHttpActionResult Put([FromBody] RectangleDetail value) { var result = m_Repository.Update(value); if (result) { return(Ok()); } else { return(NotFound()); } }
public bool Update(RectangleDetail detail) { try { var shape = FromJson(detail); shape.Save(); return(true); } catch (Exception e) { return(false); } }
public RectangleDetail Post([FromBody] RectangleDetail value) { return(m_Repository.Insert(value)); }