public IActionResult Put([FromBody] ProductCreateInputModel model) { try { ProductControllerHelperMethods.ValidModel(model, false); _IProductService.EditProduct(model); } catch (Exception e) { return(SendRightStatus(e)); } return(Ok()); }
public IActionResult Delete(Guid id) { try { ProductControllerHelperMethods.ValidIdProperty(id); _IProductService.RemoveProduct(id); } catch (Exception e) { return(SendRightStatus(e)); } return(NoContent()); }
public ActionResult <Guid> Post([FromBody] ProductCreateInputModel model) { Guid idOfCreatedObject = new Guid(); try { ProductControllerHelperMethods.ValidModel(model, true); idOfCreatedObject = _IProductService.SetProduct(model); } catch (Exception e) { return(SendRightStatus(e)); } return(StatusCode(StatusCodes.Status201Created, idOfCreatedObject)); }
public ActionResult <ProductCreateInputModel> Get(Guid id) { ProductCreateInputModel valueResult = null; try { ProductControllerHelperMethods.ValidIdProperty(id); valueResult = _IProductService.GetProduct(id); } catch (Exception e) { return(SendRightStatus(e)); } return(Ok(valueResult)); }