예제 #1
0
        public async Task <IActionResult> CreateDoorNumber([FromBody] DoorsNumber door)
        {
            if (door.IsObjectNull())
            {
                return(BadRequest("door object is null"));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid object Model"));
            }

            _repoWrapper.DoorsNumber.Create(door);
            await _unitOfWork.SaveChangesAsync();

            return(CreatedAtRoute("DoorById", new { id = door.Id }, door));
        }
예제 #2
0
        public async Task <IActionResult> UpdateDoorNumber([FromBody] DoorsNumber door, int id)
        {
            if (door.IsObjectNull())
            {
                return(BadRequest("Door object is null"));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid object Model"));
            }

            if (door.IsDifferentObject(id))
            {
                return(NotFound());
            }

            _repoWrapper.DoorsNumber.Update(door);
            await _unitOfWork.SaveChangesAsync();

            return(NoContent());
        }
예제 #3
0
 internal Car(Dictionary <string, string> i_VehicleProperties)
     : base(i_VehicleProperties)
 {
     m_ColorOfCar    = FieldsChecker.CheckValidColor(i_VehicleProperties["Color of car"]);
     m_NumberOfDoors = FieldsChecker.CheckValidNumberOfDoors(i_VehicleProperties["Number of doors"]);
 }