Ejemplo n.º 1
0
        public async Task <DTOclaimtemplate> Postclaimtemplate(DTOclaimtemplate newDTO)
        {
            claimtemplate newProd = EntityMapper.updateEntity(null, newDTO);

            db.claimtemplates.Add(newProd);
            await db.SaveChangesAsync();

            return(newDTO);
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        public string getClaimTemplateJustJson(int productID)
        {
            DTOclaimtemplate claimTemplate = getClaimTemplateForProduct(productID);

            if (claimTemplate != null)
            {
                return(claimTemplate.formDataRequiredJson);
            }
            else
            {
                return("No template available");
            }
        }
Ejemplo n.º 4
0
        //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);
        }
Ejemplo n.º 5
0
        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);
        }