public bool UpdateObject(DeepSkyModel UpdateSky) { DeepSkyEntity UpdateSEntity = new DeepSkyEntity(); //Seems to be particular about instantiating stuff... UpdateSEntity.NGCID = UpdateSky.NGCID; UpdateSEntity.DeepSkyInfo = UpdateSky.DeepSkyInfo; return(_repository.UpdateObject(UpdateSEntity)); }
public IActionResult Put([FromBody] DeepSkyModel UpdateSkyInstance) { if (_helper.UpdateObject(UpdateSkyInstance)) { return(Ok("The object has been successfully updated.")); } else { return(NotFound("Unable to update the object.")); } }
//Methods #region Methods public bool CreateObject(DeepSkyModel CreateSky) { //Debugging DeepSkyEntity CreateSEntity = new DeepSkyEntity(); //Map from model to the entity. CreateSEntity.NGCID = CreateSky.NGCID; CreateSEntity.DeepSkyInfo = CreateSky.DeepSkyInfo; return(_repository.CreateObject(CreateSEntity)); //return _repository.CreateObject(SkyInstance as DeepSkyEntity); }
public IActionResult Post([FromBody] DeepSkyModel NewSkyInstance) //Post the model, not the entity here. { if (ModelState.IsValid && _helper.CreateObject(NewSkyInstance) == true) { return(Ok("The object has been successfully added.")); } else { return(NotFound("There was an error adding the object.")); } }