public async Task <DTOproductsalespermonth> Postproductsalespermonth(DTOproductsalespermonth newDTO)
        {
            productsalespermonth newProd = EntityMapper.updateEntity(null, newDTO);

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

            return(newDTO);
        }
        public async Task <IHttpActionResult> Putproductsalespermonth(int ID, DTOproductsalespermonth editedDTO)
        {
            productsalespermonth toUpdate = db.productsalespermonths.Find(ID);

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public static productsalespermonth updateEntity(productsalespermonth entityObjct, DTOproductsalespermonth dto)
        {
            if (entityObjct == null)
            {
                entityObjct = new productsalespermonth();
            }

            entityObjct.activeProductItemStartDate = dto.activeProductItemStartDate;
            entityObjct.datum       = dto.datum;
            entityObjct.Product_ID  = dto.Product_ID;
            entityObjct.productName = dto.productName;
            entityObjct.sales       = dto.sales;

            return(entityObjct);
        }