示例#1
0
        public IActionResult DeleteParcel(int id, [FromBody] Model.ParcelModel model)
        {
            var entity = _mapper.Map <Entity.Parcel>(model);

            _pimsService.Parcel.Remove(entity);

            return(new JsonResult(model));
        }
示例#2
0
        public IActionResult UpdateParcel(int id, [FromBody] Model.ParcelModel model)
        {
            var entity = _mapper.Map <Entity.Parcel>(model);

            var parcel = _pimsService.Parcel.Update(entity);

            return(new JsonResult(_mapper.Map <Model.ParcelModel>(parcel)));
        }
示例#3
0
        public IActionResult UpdateParcel(int id, [FromBody] Model.ParcelModel model)
        {
            var entity = _mapper.Map <Entity.Parcel>(model);

            _pimsService.Parcel.Update(entity); // TODO: Update related properties (i.e. Address).
            var parcel = _mapper.Map <Model.ParcelModel>(entity);

            return(new JsonResult(parcel));
        }
示例#4
0
        public IActionResult AddParcel([FromBody] Model.ParcelModel model)
        {
            var entity = _mapper.Map <Entity.Parcel>(model);

            _pimsService.Parcel.Add(entity);
            var parcel = _mapper.Map <Model.ParcelModel>(entity);

            return(CreatedAtAction(nameof(GetParcel), new { id = parcel.Id }, parcel));
        }