Exemplo n.º 1
0
        public bool Delete(ParkingDto parkingDto)
        {
            try
            {
                if (parkingDto != null)
                {
                    _context.Parking.Remove(new Parking()
                    {
                        Address     = parkingDto.Address,
                        Description = parkingDto.Description,
                        Document    = parkingDto.Document,
                        Id          = parkingDto.Id,
                        Phone       = parkingDto.Phone
                    });

                    _context.SaveChanges();
                    return(true);
                }

                return(false);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 public static Parking DtoToEntity(this ParkingDto parkingDto)
 {
     return(new Parking()
     {
         Address = parkingDto.Address,
         Description = parkingDto.Description,
         Document = parkingDto.Document,
         Phone = parkingDto.Phone
     });
 }
Exemplo n.º 3
0
 public IActionResult Create([FromBody] ParkingDto parkingDto)
 {
     if (_parkingAppService.Create(parkingDto))
     {
         return(Ok(parkingDto));
     }
     else
     {
         return(BadRequest());
     }
 }
Exemplo n.º 4
0
 public static Parking DtoToEntity(this ParkingDto dto)
 {
     return(new Parking()
     {
         Address = dto.Address,
         Description = dto.Description,
         Document = dto.Document,
         //Id = dto.Id,
         Phone = dto.Phone
     });
 }
Exemplo n.º 5
0
 public bool Update(ParkingDto parkingDto)
 {
     try
     {
         _context.Parking.Update(parkingDto.DtoToEntity());
         _context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 6
0
        public bool Create(ParkingDto parkingDto)
        {
            //var executed = false;
            try
            {
                _context.Parking.Add(parkingDto.DtoToEntity());
                _context.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 7
0
        public bool Delete(ParkingDto parkingDto)
        {
            try
            {
                if (parkingDto != null)
                {
                    _context.Parking.Remove(parkingDto.DtoToEntity());
                    _context.SaveChanges();
                    return(true);
                }

                return(false);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 8
0
        public bool Create(ParkingDto parkingDto)
        {
            try
            {
                _context.Parkings.Add(new Parking()
                {
                    Address     = parkingDto.Address,
                    Description = parkingDto.Description,
                    Document    = parkingDto.Document,
                    Phone       = parkingDto.Phone
                });

                _context.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 9
0
        public bool Create(ParkingDto parkingDto)
        {
            try
            {
                //_context.Parking.Add(parking);

                //_context.Parking.Add(new Parking()
                //{
                //    Address = parkingDto.Address,
                //    Description = parkingDto.Description,
                //    Document = parkingDto.Document,
                //    Phone = parkingDto.Phone
                //});

                _context.Parking.Add(parkingDto.DtoToEntity());

                _context.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 10
0
 public bool Create(ParkingDto parkingDto)
 {
     return(_parkingDomainService.Create(parkingDto));
 }
Exemplo n.º 11
0
 public bool Update(ParkingDto parkingDto)
 {
     return(_parkingDomainService.Update(parkingDto));
 }
Exemplo n.º 12
0
 public bool Delete(ParkingDto parking)
 {
     return(_parkingDomainService.Create(parking));
 }