public IHttpActionResult PostLot(Lot lot) { if (string.IsNullOrWhiteSpace(lot.Name) || string.IsNullOrWhiteSpace(lot.Specification) || string.IsNullOrWhiteSpace(lot.Category) || lot.Bet == 0 || lot.Duration == 0) { return(BadRequest("Please, correct your inputs")); } else { LOperations.SaveLot(lot); return(Ok()); } }
public IHttpActionResult PostLot(LotModel _lot) { if (string.IsNullOrWhiteSpace(_lot.Name) || string.IsNullOrWhiteSpace(_lot.Specification) || string.IsNullOrWhiteSpace(_lot.Category) || _lot.Bet == 0 || _lot.Duration == 0) { return(BadRequest("Please, correct your inputs")); } else if (!Regex.IsMatch(_lot.Name, @"^[\d|\D]{1,50}$")) { return(BadRequest("Name is too longs")); } else if (!Regex.IsMatch(_lot.Specification, @"^[\d|\D]{1,1000}$")) { return(BadRequest("Specification is too longs")); } else { Lot lot = Mapper.Map <LotModel, Lot>(_lot); LOperations.SaveLot(lot); return(Ok()); } }