public IActionResult Post([FromBody] LaptopInputModel inputModel) { if (inputModel != null && this.ModelState.IsValid) { var laptop = this.mappingService.Map <Laptop>(inputModel); this.AdministrationService.Create(laptop); return(this.Created(string.Empty, laptop)); } return(this.BadRequest("Invalid input")); }
public IActionResult Put([FromBody] LaptopInputModel inputModel) { if (inputModel != null) { var laptop = this.AdministrationService.Get(inputModel.Id); this.mappingService.Map(inputModel, laptop); this.AdministrationService.Update(laptop); return(this.Ok()); } return(this.BadRequest("Invalid input")); }