Exemplo n.º 1
0
        public async Task <DTOinsurancetype> Postinsurancetype(DTOinsurancetype newDTO)
        {
            insurancetype newProd = EntityMapper.updateEntity(null, newDTO);

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

            return(newDTO);
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Putinsurancetype(int ID, DTOinsurancetype editedDTO)
        {
            insurancetype toUpdate = db.insurancetypes.Find(ID);

            toUpdate = EntityMapper.updateEntity(toUpdate, editedDTO);
            db.Entry(toUpdate).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public static insurancetype updateEntity(insurancetype entityObjct, DTOinsurancetype dto)
        {
            if (entityObjct == null)
            {
                entityObjct = new insurancetype();
            }

            entityObjct.InsuranceType_ID         = dto.InsuranceType_ID;
            entityObjct.insuranctTypeDescription = dto.insuranctTypeDescription;
            entityObjct.RequirementsForPurchase  = dto.RequirementsForPurchase;

            return(entityObjct);
        }