public async Task <DTOnotificationlog> Postnotificationlog(DTOnotificationlog newDTO) { notificationlog newProd = EntityMapper.updateEntity(null, newDTO); db.notificationlogs.Add(newProd); await db.SaveChangesAsync(); return(newDTO); }
public async Task <IHttpActionResult> Putnotificationlog(int ID, DTOnotificationlog editedDTO) { notificationlog toUpdate = db.notificationlogs.Find(ID); toUpdate = EntityMapper.updateEntity(toUpdate, editedDTO); db.Entry(toUpdate).State = EntityState.Modified; await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
public static notificationlog updateEntity(notificationlog entityObjct, DTOnotificationlog dto) { if (entityObjct == null) { entityObjct = new notificationlog(); } entityObjct.NotificationLog_ID = dto.NotificationLog_ID; entityObjct.notificationType = dto.notificationType; entityObjct.notificationReceiver = dto.notificationReceiver; entityObjct.notificationDateSent = dto.notificationDateSent; return(entityObjct); }