コード例 #1
0
        public static TransporteStatusModel Transform(DTOTransporteStatus transporteStatus)
        {
            var modeloModel = new TransporteStatusModel
            {
                Id           = transporteStatus.Id.ToString(CultureInfo.InvariantCulture),
                TransporteId = transporteStatus.TransporteId.ToString(CultureInfo.InvariantCulture),
                StatusId     = transporteStatus.StatusId.ToString(CultureInfo.InvariantCulture),
                Data         = transporteStatus.Data.ToString("yyyy-MM-dd HH:mm:ss")
            };

            return(modeloModel);
        }
コード例 #2
0
        public void IncluirStatus(DTOTransporteStatus status)
        {
            var statusModel = TransporteStatusModel.Transform(status);
            var sql         = statusModel.QueryInsert();

            using (var contexto = new Contexto())
            {
                var result = contexto.ExecutaComandoComRetorno(sql);
                result.Read();
                status.Id = Convert.ToInt32(result["LASTID"]);
            }
        }
コード例 #3
0
        public HttpResponseMessage Put(DTOTransporte transporte)
        {
            try
            {
                var transporteAntigo = _transporteServico.GetAll().Where(x => x.Id == transporte.Id).FirstOrDefault();
                if (transporte.Status != transporteAntigo.Status)
                {
                    var dtoStatus = new DTOTransporteStatus();
                    dtoStatus.StatusId     = (int)transporteAntigo.Status;
                    dtoStatus.TransporteId = transporte.Id;
                    dtoStatus.Data         = DateTime.Now;

                    _transporteServico.IncluirStatus(dtoStatus);
                }

                _transporteServico.Salvar(transporte);
                return(Request.CreateResponse(HttpStatusCode.OK, transporte));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
コード例 #4
0
 public void IncluirStatus(DTOTransporteStatus status)
 {
     _transporteRepositorio.IncluirStatus(status);
 }