public IHttpActionResult GetLnkUDOOfID(int id) { try { EFLnkUDO ef_act = new EFLnkUDO(new EFDbContext()); LnkUDO link = ef_act .Context .Where(d => d.idLinkUDO == id) .ToList() .Select(m => m.GetLnkUDO()) .FirstOrDefault(); return(Ok(link)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public static LnkUDO GetLnkUDO(this LnkUDO l) { if (l == null) { return(null); } return(new LnkUDO() { idLinkUDO = l.idLinkUDO, IDUnit = l.IDUnit, IDDamage = l.IDDamage, IDOperation = l.IDOperation, HumanHour = l.HumanHour, Note = l.Note, RefUnit = l.RefUnit.GetRefUnit(), RefDamage = l.RefDamage.GetRefDamage(), RefOperation = l.RefOperation.GetRefOperation(), TabActions = null }); }