Пример #1
0
        public IActionResult CreateCargo([FromBody] CargoModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var cargo = _mapper.Map <Cargo>(model);

            model.Cargo_Id = _cargoRepository.CreateCargo(cargo);

            return(Ok(model));
        }
Пример #2
0
        public IActionResult CreateCargo([FromBody] CargoModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var cargo = new Cargo
            {
                CargoDesc = model.Cargo_Desc
            };

            var newCargo = _cargoRepository.CreateCargo(cargo);

            model.Cargo_Id = newCargo.CargoId;

            return(Ok(model));
        }