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