public async Task <IActionResult> AddWidth([FromBody] AddingTyreSizeVm model) { var check = await _tyreWidthRepository.Query().FirstOrDefaultAsync(x => x.Size == model.Size && x.CategoryId == model.CategoryId); if (check != null) { return(BadRequest(new { message = "This Width is exist." })); } var width = new TyreWidth { CategoryId = model.CategoryId, Size = model.Size }; using (var transaction = _tyreWidthRepository.BeginTransaction()) { _tyreWidthRepository.Add(width); await _tyreWidthRepository.SaveChangesAsync(); transaction.Commit(); } return(Ok()); }
public TyreParams(TyreWidth width, TyreProfile profile, TyreRadius radius) { Profile = (float)profile / 100f; Width = (float)width; Radius = (float)radius; }
public void ReadXml(System.Xml.XmlReader r) { if (r.IsEmptyElement) return; if (r.Read()) { this.TyreWidth = (TyreWidth)r.ReadElementContentAsInt(); this.TyreProfile = (TyreProfile)r.ReadElementContentAsInt(); this.TyreRadius = (TyreRadius)r.ReadElementContentAsInt(); } }