/// <summary> /// Void object to object /// </summary> /// <param name="vo"></param> /// <returns></returns> public static Operador voToObject(OperadorVo vo) { return(new Operador { id = vo.id, nombre = vo.nombre, ap_paterno = vo.ap_paterno, ap_materno = vo.ap_materno, timestamp = Convert.ToDateTime(vo.timestamp), updated = Convert.ToDateTime(vo.updated), compania = new Compania { id = vo.compania_id } }); }
public HttpResponseMessage updateOperadorExplosivos([FromBody] OperadorVo operador_vo) { TransactionResult tr = operador_service.update(operador_vo, 1); IDictionary <string, string> data = new Dictionary <string, string>(); if (tr == TransactionResult.OK) { data.Add("message", "Object updated."); return(Request.CreateResponse(HttpStatusCode.OK, data)); } else { data.Add("message", "There was an error attending your request."); return(Request.CreateResponse(HttpStatusCode.BadRequest, data)); } }
public HttpResponseMessage create([FromBody] OperadorVo operador_vo) { TransactionResult tr = operador_service.create(operador_vo, 2); IDictionary <string, string> data = new Dictionary <string, string>(); if (tr == TransactionResult.CREATED) { data.Add("message", "Object created."); return(Request.CreateResponse(HttpStatusCode.Created, data)); } else if (tr == TransactionResult.EXISTS) { data.Add("message", "Object already existed."); return(Request.CreateResponse(HttpStatusCode.Conflict, data)); } else { data.Add("message", "There was an error attending your request."); return(Request.CreateResponse(HttpStatusCode.BadRequest, data)); } }
public TransactionResult update(OperadorVo operador_vo, int sistema) { return(operador_repository.update(OperadorAdapter.voToObject(operador_vo), sistema)); }
public TransactionResult create(OperadorVo operador_vo, int sistema) { Operador operador = OperadorAdapter.voToObject(operador_vo); return(operador_repository.create(operador, sistema)); }