public bool CheckValidity(Models.AlertDataModel dataModel) { ProductRepository repository = new ProductRepository(); bool productIdResponse = repository.CheckProductId(dataModel.ProductIdConfirmed); bool detailsresponse = CheckContactNoAndName(dataModel.CustomerContactNo, dataModel.CustomerName, dataModel.CustomerEmailId); if (productIdResponse == false || detailsresponse == false) { return(false); } return(true); }
public ActionResult Post([FromBody] Models.AlertDataModel dataModel) { Validation validations = new Validation(); bool response = validations.CheckValidity(dataModel); if (response == false) { return(BadRequest("Please Enter Valid Details")); } else { this._alertDataBaseRepository.Add(dataModel); string message = "Order with ProductId " + dataModel.ProductIdConfirmed + " has been Confirmed"; return(Ok(message)); } }