Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
 public TyreParams(TyreWidth width, TyreProfile profile, TyreRadius radius)
 {
     Profile = (float)profile / 100f;
     Width   = (float)width;
     Radius  = (float)radius;
 }
Ejemplo n.º 3
0
 public TyreParams(TyreWidth width, TyreProfile profile, TyreRadius radius)
 {
     Profile = (float)profile / 100f;
     Width = (float)width;
     Radius = (float)radius;
 }
Ejemplo n.º 4
0
 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();
     }
 }