public async Task <DTOclaimtemplate> Postclaimtemplate(DTOclaimtemplate newDTO) { claimtemplate newProd = EntityMapper.updateEntity(null, newDTO); db.claimtemplates.Add(newProd); await db.SaveChangesAsync(); return(newDTO); }
public async Task <IHttpActionResult> Putclaimtemplate(int ID, DTOclaimtemplate editedDTO) { claimtemplate toUpdate = db.claimtemplates.Find(ID); toUpdate = EntityMapper.updateEntity(toUpdate, editedDTO); db.Entry(toUpdate).State = EntityState.Modified; await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
public string getClaimTemplateJustJson(int productID) { DTOclaimtemplate claimTemplate = getClaimTemplateForProduct(productID); if (claimTemplate != null) { return(claimTemplate.formDataRequiredJson); } else { return("No template available"); } }
//get claim template object for a specific productID public DTOclaimtemplate getClaimTemplateForProduct(int productID) { DTOclaimtemplate toReturn = null; int templateID = getClaimTemplateID(productID); if (templateID != 0) { claimtemplate entityTemplate = (from t in db.claimtemplates where t.claimtemplate_ID == templateID select t).SingleOrDefault(); toReturn = new DTOclaimtemplate(entityTemplate); } return(toReturn); }
public static claimtemplate updateEntity(claimtemplate entityObjct, DTOclaimtemplate dto) { if (entityObjct == null) { entityObjct = new claimtemplate(); } entityObjct.claimtemplate_ID = dto.claimtemplate_ID; entityObjct.templateName = dto.templateName; entityObjct.formDataRequiredJson = dto.formDataRequiredJson; return(entityObjct); }