internal void SyncAttachments(Attachements item) { AttachmentsEntity ent = new AttachmentsEntity() { AttachementId = Convert.ToInt32(item.AttachementId), Bezeichnung = item.Bezeichnung, Filename = item.Filename, HauspaketId = Convert.ToInt32(item.HauspaketId), Mimetype = item.Mimetype, Size = Convert.ToInt32(item.Size) }; switch (item.SyncOperation) { case "INSERT": { dataHandler.InsertAttachements(ent); } break; case "UPDATE": { dataHandler.UpdateAttachements(ent); } break; case "DELETE": { dataHandler.DeleteAttachements(ent); } break; } }
public void DeleteAttachements(AttachmentsEntity attachementsEntity) { attachements result = (from x in db.attachements where x.attachement_id == attachementsEntity.AttachementId select x).SingleOrDefault(); db.attachements.Remove(result); db.SaveChanges(); }
public void UpdateAttachements(AttachmentsEntity attachementsEntity) { attachements result = (from x in db.attachements where x.attachement_id == attachementsEntity.AttachementId select x).SingleOrDefault(); result.attachement_id = attachementsEntity.AttachementId; result.bezeichnung = attachementsEntity.Bezeichnung; result.filename = attachementsEntity.Filename; result.hauspaket_id = attachementsEntity.HauspaketId; result.mimetype = attachementsEntity.Mimetype; result.size = attachementsEntity.Size; db.SaveChanges(); }
public void InsertAttachements(AttachmentsEntity attachementsEntity) { attachements h = new attachements() { attachement_id = attachementsEntity.AttachementId, bezeichnung = attachementsEntity.Bezeichnung, filename = attachementsEntity.Filename, hauspaket_id = attachementsEntity.HauspaketId, mimetype = attachementsEntity.Mimetype, size = attachementsEntity.Size }; db.attachements.Add(h); db.SaveChanges(); }